RE: POI 3.17 Problems with border and fill styles in generating XSSF/xlsx files, viewed in MS Office 365 ProPlus
Excel -> select all rows -> sort -> select 2nd column, ascending CONFIDENTIALITY NOTICE: This e-mail, including any attachments, may contain confidential, privileged and/or proprietary information which is solely for the use of the intended recipient(s). Any review, use, disclosure, or retention by others is strictly prohibited. If you are not an intended recipient, please contact the sender and delete this e-mail, any attachments, and all copies. - To unsubscribe, e-mail: user-unsubscr...@poi.apache.org For additional commands, e-mail: user-h...@poi.apache.org
RE: POI 3.17 Problems with border and fill styles in generating XSSF/xlsx files, viewed in MS Office 365 ProPlus
As a follow-on: I created a cell style with a bottom and right border plus a background, then applied it to selective rows. It looks good when I generate the file. If I sort the rows, the background color remains for the content rows - but the border style randomly disappears. In fact the last 2 columns only have content for rows with this style (w borders), but after sorting most of those columns just lose their borders: 7 rows keep borders, 4 lose the last 2 columns' borders, 14 lose all borders after the sort. Total 163 content rows. The border dialog within Excel shows this isn't just a visual artifact: missing borders are no longer set on those content rows. The rows which keep their borders after the sort doesn't correlate with the original position of rows with borders. I don't know if this is an Excel-ism or how much POI affects it. CONFIDENTIALITY NOTICE: This e-mail, including any attachments, may contain confidential, privileged and/or proprietary information which is solely for the use of the intended recipient(s). Any review, use, disclosure, or retention by others is strictly prohibited. If you are not an intended recipient, please contact the sender and delete this e-mail, any attachments, and all copies.
RE: POI 3.17 Problems with border and fill styles in generating XSSF/xlsx files, viewed in MS Office 365 ProPlus
Perfect, thank you for the explanation and details - it worked! There is still the oddity about: > row.setRowStyle(codeFill) Only affecting cells AFTER the last one I created in the row. I've been using a limited work-around. Lastly: are row and cell styles ever combined/aggregated as they would be in Excel? Eg. if I set a row style with a background and a cell style with a border, will the cell have the background and the border, or do I need to specify the cell's style with the background as well for it to not get overwritten depending on what order I set them? Thanks! CONFIDENTIALITY NOTICE: This e-mail, including any attachments, may contain confidential, privileged and/or proprietary information which is solely for the use of the intended recipient(s). Any review, use, disclosure, or retention by others is strictly prohibited. If you are not an intended recipient, please contact the sender and delete this e-mail, any attachments, and all copies.
RE: POI 3.17 Problems with border and fill styles in generating XSSF/xlsx files, viewed in MS Office 365 ProPlus
1. after more experimenting: Nope, Excel skips displaying any Medium-thickness borders on Column “A”, but will at least display the others. Which is idiotic and negates any WYSIWYG of Excel. 2. background fill: yes, that works fine through Excel. Except I am generating files and cannot go through every sheet of every workbook and manually make changes every time. Also: I cannot see either image you included. From: Mark Murphy [mailto:jmarkmur...@gmail.com] Sent: Friday, March 02, 2018 11:20 AM To: POI Users List <user@poi.apache.org> Subject: Re: POI 3.17 Problems with border and fill styles in generating XSSF/xlsx files, viewed in MS Office 365 ProPlus Can you do what you want in Excel? Here is what it looks like when I add borders in Excel. [cid:ii_jea7bvbr0_161e7b89dcdf1fa2] The borders are re there though. If I look in Print Preview, it looks like this: [cid:ii_jea7dai41_161e7b9a118b7e5a] So maybe what you are seeing is just the way Excel renders the borders you have created. On Fri, Mar 2, 2018 at 10:22 AM, Dagnon, William <william.dag...@wpsic.com<mailto:william.dag...@wpsic.com>> wrote: Hello, long time fan, but long time since I last used POI. I've downloaded POI 3.17 and I'm generating XLSX files from Groovy within Eclipse IDE backed by Java 8, and started at: https://poi.apache.org/spreadsheet/quick-guide.html#FillsAndFrills<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpoi.apache.org%2Fspreadsheet%2Fquick-guide.html%23FillsAndFrills=02%7C01%7CWilliam.Dagnon%40wpsic.com%7C7c13f919985c4262ad7708d58061e63d%7C6b61581df3634ffb8f7fd517e2227a0c%7C0%7C0%7C636556080333189845=lUqZ8EdvLV0VWbC9TQQEJ0OsbfYn4x6yTKN8cyAt7To%3D=0> Though looked at the API when there were problems and updated my code slightly to use XSSFColors instead of IndexedColors. However some of the formatting I'm trying is failing to display in MS Office 365 ProPlus. Unfortunately I don't have anything else to test it in: 1. LEFT BORDER NEVER DISPLAYS in "A" Column I'm putting a medium border around a group of cells: the top, right, and bottom cells' borders display fine, but the left border (in the left-most column, "A") never displays. This is for left-only, top-left, and bottom-left cells: for top- and bottom-, their other border DOES display. When I go into the cell style for it, the medium border is there in their graphic, and I can remove and re-add it. It simply isn't displaying in the GUI. If I go into another left-most cell - either above (one I've defined) or below (one I never did a createCell(0) call for) and put the same border in there through Excel, it also does NOT display!? Still in the Excel dialog: if I click on the top preset "Outline".. I can click all day and the format never toggles 'off' - so the left border seems to be corrupted for the whole worksheet's "A" column so much that the GUI cannot overwrite the corruption. I can set the left border on any non-"A" column cells through Excel just fine. My Groovy code looks like: Workbook wb = new XSSFWorkbook(); XSSFColor black = new XSSFColor(new java.awt.Color(0, 0, 0)); CellStyle vLeft = wb.createCellStyle() // I only make 1 style for all (only) left-bordered cells. Another for the top-left corner, etc. vLeft.setBorderLeft(BorderStyle.MEDIUM) // same style I use for all the working cells vLeft.setLeftBorderColor(black); // same color I use for correctly-displaying border cells XSSFSheet newSheet = wb.createSheet(name) row = newSheet.createRow(ii) Cell content = row.createCell(jj++) content.setCellStyle(vLeft) 1. BACKGROUND COLOR DISPLAYS AS BLACK I'm adding a blue-gray background color to certain lines, but it changes the cell to fill completely black. XSSFColor bluegray = new XSSFColor(new java.awt.Color(217, 225, 242)); CellStyle codeFill = wb.createCellStyle(); codeFill.setFillBackgroundColor(bluegray); // seems to set Foreground color instead codeFill.setFillPattern(FillPatternType.SOLID_FOREGROUND); // As the Quick Guide directs: leave it out and NO Fill styles get set! cell.setCellStyle(codeFill) // No other styles on these cells... so far. Going into Format Cells.. > Fill, the pattern color is correct. Pattern style is empty, and under Background Color, the button at top "No Color" is depressed. So it seems like the underlying code is confused about what it is setting. 1. ROW STYLE FILL = BLACK, ONLY to the REST of the ROW If I instead try: row.setRowStyle(codeFill) The bad styles described above in #2 are applied to all columns of the row AFTER the current one instead of to ALL cells in the row - why?? I don't have the time to delve into the details of why these fail to work, so I'm ask
POI 3.17 Problems with border and fill styles in generating XSSF/xlsx files, viewed in MS Office 365 ProPlus
Hello, long time fan, but long time since I last used POI. I've downloaded POI 3.17 and I'm generating XLSX files from Groovy within Eclipse IDE backed by Java 8, and started at: https://poi.apache.org/spreadsheet/quick-guide.html#FillsAndFrills Though looked at the API when there were problems and updated my code slightly to use XSSFColors instead of IndexedColors. However some of the formatting I'm trying is failing to display in MS Office 365 ProPlus. Unfortunately I don't have anything else to test it in: 1. LEFT BORDER NEVER DISPLAYS in "A" Column I'm putting a medium border around a group of cells: the top, right, and bottom cells' borders display fine, but the left border (in the left-most column, "A") never displays. This is for left-only, top-left, and bottom-left cells: for top- and bottom-, their other border DOES display. When I go into the cell style for it, the medium border is there in their graphic, and I can remove and re-add it. It simply isn't displaying in the GUI. If I go into another left-most cell - either above (one I've defined) or below (one I never did a createCell(0) call for) and put the same border in there through Excel, it also does NOT display!? Still in the Excel dialog: if I click on the top preset "Outline".. I can click all day and the format never toggles 'off' - so the left border seems to be corrupted for the whole worksheet's "A" column so much that the GUI cannot overwrite the corruption. I can set the left border on any non-"A" column cells through Excel just fine. My Groovy code looks like: Workbook wb = new XSSFWorkbook(); XSSFColor black = new XSSFColor(new java.awt.Color(0, 0, 0)); CellStyle vLeft = wb.createCellStyle() // I only make 1 style for all (only) left-bordered cells. Another for the top-left corner, etc. vLeft.setBorderLeft(BorderStyle.MEDIUM) // same style I use for all the working cells vLeft.setLeftBorderColor(black); // same color I use for correctly-displaying border cells XSSFSheet newSheet = wb.createSheet(name) row = newSheet.createRow(ii) Cell content = row.createCell(jj++) content.setCellStyle(vLeft) 1. BACKGROUND COLOR DISPLAYS AS BLACK I'm adding a blue-gray background color to certain lines, but it changes the cell to fill completely black. XSSFColor bluegray = new XSSFColor(new java.awt.Color(217, 225, 242)); CellStyle codeFill = wb.createCellStyle(); codeFill.setFillBackgroundColor(bluegray); // seems to set Foreground color instead codeFill.setFillPattern(FillPatternType.SOLID_FOREGROUND); // As the Quick Guide directs: leave it out and NO Fill styles get set! cell.setCellStyle(codeFill) // No other styles on these cells... so far. Going into Format Cells.. > Fill, the pattern color is correct. Pattern style is empty, and under Background Color, the button at top "No Color" is depressed. So it seems like the underlying code is confused about what it is setting. 1. ROW STYLE FILL = BLACK, ONLY to the REST of the ROW If I instead try: row.setRowStyle(codeFill) The bad styles described above in #2 are applied to all columns of the row AFTER the current one instead of to ALL cells in the row - why?? I don't have the time to delve into the details of why these fail to work, so I'm asking here in case someone has answers/alternatives so I can get the same styles quickly. What am I doing incorrectly? Are these 3.17-specific bugs? Thanks! P.S. Apologies: sent from Outlook - I pray the content is still legible... CONFIDENTIALITY NOTICE: This e-mail, including any attachments, may contain confidential, privileged and/or proprietary information which is solely for the use of the intended recipient(s). Any review, use, disclosure, or retention by others is strictly prohibited. If you are not an intended recipient, please contact the sender and delete this e-mail, any attachments, and all copies.