ISSUE: 1
I see a very strange behavior of Apache POI, I wrote an excel file using POI 3.9. While writing the cell I added a font style of Arial 8 and normal and the cells are merged.
While viewing the report all the cell styles are fine but I see that the text are bold. When I checked the cell property it looks fine. If in the ms excel I unmerge and again merge the cells the bold goes away but when written from POI it shows as bold.
One thing I found today is it looks bold only when in 100% zoom, even if I make it 99% the bold goes away.
Could anyone please explain this behavior and let me know what I have to do to fix this.
ISSUE 2:
I am adding the copyright symbol to the footer, but for some reason I see a question mark in the footer. Any idea what should I add to get the copyright symbol?
Related
Is there any way to set style for all next cells in excel worksheet? Like for the rest of the document after certain cell?
I am using Apache POI 3.9 for exporting data to excel worksheet. Client wants colored font for invalid data. Everything is running fine, but sometimes, when I put text in empty cells in "INFORMATION" column, it makes font colored red, even after reseting cell style or explicitly asking for condition and then setting default cell style. Youre more likely to get my idea from pic of code.
Ive uploaded some pic of excel too. Hope it helps. It starts on row 37, text somehow changes color even after not running through setting conditions. I havent recognized any pattern in there.
I tried to change conditions, change cell style setting location in code... Had no effect.
Edit: It seems like the problem is not in AP but in Excel itself. It looks like the font color is changed after user input and its caused by autoformatting that is based on the context. So only option here is to change style of previous data. Could not find any other solution to this.
my Excel sheet seems like what you see above. I'm using Apache POI.
I need to create a XML element for each register you see. Using the Borders that you see. How can I get the border information of a specific cell?
I tried many code but they use the workbook and gets its style. I want to be able to get Cell border of one specific Cell.
System.out.println(workbook.getCellStyleAt(0).getBorderLeft());
Excel file:
I have excel file, which I successfully imported to confluence, using Excel from macro browser (just to new blank doc in confluence).
But column width, in which cells values have spaces (like "Values Have Spaces") is broken, and corresponding column looks bad (some rows instead of one in corresponding cells).
Guessing: its due to the spaces. If change with smth like "no_spaces_now" - rows became ok in excel confluence file.
How to fix this without removing spaces? (Rows in original local Excel file are looking good).
Problem is partially fixed with proposed by Jeeped checking/setting the formats. Other problem (with absence of horisontal scrolling for excel on confluence, at least in this case) raised with Atlassian.
this question will be closed as answered.
I just ran into this, myself.
Imported Excel seemed to justify any of my columns, so the spacing looked ugly, as in the OP's attached image. I did not do any formatting to default excel columns (I try to avoid formatting or anything fancy in excel as importing to confluence always results in some sort of uglifying of excel)
Anyways, the fix for me was to Center (horizontal) my excel text (which obviously looks ugly in Excel). Doing this meant my cell text in the imported table is now aligned left, rather than Justified.
If anyone has found a better solution, and can properly describe it, I would be delighted to hear. :)
our Java EE applications writes large (>3000 rows, >300 columns) Excel files using Apache POI. We have implemented the customer's requirement that many (>500) of the cells in the written file have a partial text formatting, i.e. the text in one cell is partially red and bold, and partially black.
Apache POI does not complain when writing the files, and they can be opened, BUT Excel 97 misdisplays them: parts of the cells have the wrong font size, and cells with multiple font colors cannot be changed (altering the font size on them does not work).
Also, Excel 2010 complains that the file is insecure (when downloaded from the server), and both Excel 97 and Excel 2010 crash on the exported files frequently.
The previous version of the application used JExcelApi and did not write multiformatted text cells. The files generated by the server using the previos (JExcelApi-powered) version of the application do display normally in Office2010, without the security warning.
Did anyone come across these issues and if so, how can I fix them?
Also, did anyone figure out why setting AutoFilters fails to show up in Office 2010 in the specified, yet shows up in Excel 97 correctly (so it sometimes crashes or works just until one AutoFilter is selected?).
Finally, I have tried to roundtrip an Excel export of the older version of the application, and found that Apache POI reduces the file size by >35%, while breaking the file's contents - although no changes are applied (just reading the file into a HSSF Workbook and re-writing it into a ByteArrayOutputStream. Did anyone figure out how to prevent POI from altering the written file?
Thanks,
Michael
There's a lot of questions here, but it sounds like POI is outputting records that 97 is misinterpreting. There are significant differences between a 97' .xls and a 2003 .xls. The dialog behaving strangely is often a symptom of a malformed record. Excel 2010 has a binary file validator that it runs internally on any of the binary file format files (BIFF). It will pick up on any records that aren't to the BIFF specifications.
I'm not sure what's going on with the AutoFilters or the altering behavior.
If you're having a lot of trouble with POI, you may wish to check out OfficeWriter which does a pretty good job with 2010 validation and styles in general.
DISCLAIMER: I'm one of the engineers who wrote the latest version.
The root cause of our problem was traced to conditional formatting introduced in the excel template files. This resulted in the output file having conditional formatting.
We got rid of the conditional formatting and all is well now !
The problem manifests very severely when the users try to access the files over network.
Conditional formatting can be removed from excel.
Do ensure to remove the conditional formatting from all sheets / styles as well.
I run live market charts in Excel. A graph indicator runs from live data fed by the broker through the DDE facility in Microsoft Excel. It works fine and I am happy with it - except for one blemish I hope you can assist with.
The lines of the graph (it is a line chart type) are created in real time. The present time and the past time are great, very clean. Unfortunately in the period just ahead i.e. that hasn't arrived yet, the lines of the graph drop to zero and crawl along the x-axis into the future. This spoils the current reading of the graph.
Is there any way I can prevent this happening so that the lines (properly called curves) only exist in the past and current time period. The worksheet is set not to show zero values in formulae, but the charting facility does not appear to have this function.
If you put #N/A in the cell (using the =NA() function) the points are not drawn.
To hide the ugliness of your cells now having #N/A in them for future dates you can use a number format or conditional formatting to hide error values. You do this by adding a formula to your conditional formatting of
=ISNA(A1)
and setting the format to be a white font on a white background. Which makes the cells with #N/A in them appear blank. For versions of Excel prior to conditional formatting being available you can do the same thing with a number format but in reverse. i.e., set your font to white so all cells are invisible by default and set your number format to:
[black]0.0;[red]-0.0;[black]0.0;[black]
which should make anything that isn't an error appear with either a black or red font colour.
Regards
Dave
I once saved an Excel 97 Worksheet (with charts) in Excel 2003. After that, whenever I saved the file in '97, I got a prompt telling me that the spreadsheet was created in a newer version of Excel.
To eliminate the prompt I opened it in 2003 and saved it as an Excel 5.0/95 Workbook (*.xls). Then whenever I opened it in 97 the line charts dropped to zero at the end. They didn't do that before.
To correct the problem I right-clicked on the chart, selected Chart type, selected Custom Types, then "Colored Lines". Apparently when I saved it as Excel 5.0/95 that chart type was not supported, so the program defaulted to the type "Smooth Lines". After changing the chart type to "Colored Lines" it was only necessary to do some minor formatting.
This experience suggests a solution to the line dropping to zero problem regardless of what triggered it. Simply change the chart type. When I did that the dropped line disappeared and I didn't have to use the #N/A approach.