ASF Bugzilla – Attachment 33457 Details for
Bug 58787
[patch] Border utility to set cell styles around a range of cells
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
This is a SVN diff of the quick-guide.xml
file_58787.txt (text/plain), 4.11 KB, created by
Mark Murphy
on 2016-01-17 05:25:32 UTC
(
hide
)
Description:
This is a SVN diff of the quick-guide.xml
Filename:
MIME Type:
Creator:
Mark Murphy
Created:
2016-01-17 05:25:32 UTC
Size:
4.11 KB
patch
obsolete
>Index: src/documentation/content/xdocs/spreadsheet/quick-guide.xml >=================================================================== >--- src/documentation/content/xdocs/spreadsheet/quick-guide.xml (revision 1725054) >+++ src/documentation/content/xdocs/spreadsheet/quick-guide.xml (working copy) >@@ -75,6 +75,7 @@ > <li><link href="#ConditionalFormatting">Conditional Formatting</link></li> > <li><link href="#Hiding">Hiding and Un-Hiding Rows</link></li> > <li><link href="#CellProperties">Setting Cell Properties</link></li> >+ <li><link href="#DrawingBorders">Drawing Borders</link></li> > </ul> > </section> > <section><title>Features</title> >@@ -2202,6 +2203,63 @@ > cell's existing style properties. If a property already exists, it is replaced with the new property. If a property does not > exist, it is added. This method will not remove CellStyle properties. > </p> >- </section> >- </body> >+ </section> >+ <anchor id="DrawingBorders"/> >+ <section> >+ <title>Drawing Borders</title> >+ <p> >+ In Excel, you can apply a set of borders on an entire workbook region at the press of a button. The CellBorder >+ object simulates this with methods and constants defined to allow drawing top, bottom, left, right, horizontal, >+ vertical, inside, outside, or all borders around a range of cells. Additional methods allow for applying colors >+ to the borders. >+ </p> >+ <p> >+ It works like this: you create a CellBorder object which is a container for the borders you wish to apply to a >+ sheet. Then you add borders and colors to the CellBorder, and finally apply it to whichever sheets you need >+ that set of borders on. You can create multiple CellBorder objects and apply them to a single sheet, or you can >+ apply the same CellBorder object to multiple sheets. It is just like a preprinted form. >+ </p> >+ <source> >+ // draw borders (three 3x3 grids) >+ CellBorder cb = new CellBorder(); >+ // #1) these borders will all be medium in default color >+ cb.drawBorders(new CellRangeAddress(1, 3, 1, 3), >+ CellStyle.BORDER_MEDIUM, CellBorder.EXTENT_ALL); >+ // #2) these cells will have medium outside borders and thin inside borders >+ cb.drawBorders(new CellRangeAddress(5, 7, 1, 3), >+ CellStyle.BORDER_MEDIUM, CellBorder.EXTENT_OUTSIDE); >+ cb.drawBorders(new CellRangeAddress(5, 7, 1, 3), CellStyle.BORDER_THIN, >+ CellBorder.EXTENT_INSIDE); >+ // #3) these cells will all be medium weight with different colors for the >+ // outside, inside horizontal, and inside vertical borders. The center >+ // cell will have no borders. >+ cb.drawBorders(new CellRangeAddress(9, 11, 1, 3), >+ CellStyle.BORDER_MEDIUM, IndexedColors.RED.getIndex(), >+ CellBorder.EXTENT_OUTSIDE); >+ cb.drawBorders(new CellRangeAddress(9, 11, 1, 3), >+ CellStyle.BORDER_MEDIUM, IndexedColors.BLUE.getIndex(), >+ CellBorder.EXTENT_INSIDE_VERTICAL); >+ cb.drawBorders(new CellRangeAddress(9, 11, 1, 3), >+ CellStyle.BORDER_MEDIUM, IndexedColors.GREEN.getIndex(), >+ CellBorder.EXTENT_INSIDE_HORIZONTAL); >+ cb.drawBorders(new CellRangeAddress(10, 10, 2, 2), >+ CellStyle.BORDER_NONE, >+ CellBorder.EXTENT_ALL); >+ >+ // apply borders to sheet >+ Workbook wb = new XSSFWorkbook(); >+ Sheet sh = wb.createSheet("Sheet1"); >+ cb.applyBorders(sh); >+ </source> >+ <p> >+ NOTE: The last cb.drawBorders() call removes the borders from the range by using CellStyle.BORDER_NONE. Like >+ setCellStyleProperties, the applyBorders method merges the properties of a cell style, so existing borders >+ are changed only if they are replaced by something else, or removed only if they are replaced by >+ CellStyle.BORDER_NONE. To remove a color from a border, use IndexedColor.AUTOMATIC.getIndex(). >+ </p> >+ <p> >+ This does not work with diagonal borders yet. >+ </p> >+ </section> >+ </body> > </document>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 58787
:
33391
|
33455
|
33456
|
33457
|
33667
|
33684
|
33948