i'm writing a program that calculates moments from a shape and writes the results to an excel spreadsheet, using the apache poi package
Anyway, i'm getting the correct figures its just when i write them to the spreadsheet, the figures mysteriously change, for example the program will produce a result like 8.092238721555691E-4, but in the spreadsheet its stored as 0.000809224....
To deepen the mystery some the figures are being stored correctly...
Has anyone any experience of something similar, or any suggestions?
Both are same: you can read 8.092238721555691E-4 as 8.092238721555691 * (10^-4)
Related
My company calls customers and offers them to buy things. Every month we get 20 new excel files ,each including thousands of phone numbers and he has a staff calling them.
The problem is that sometimes n "new" excel file he recieves contains phone-numbers which already existed in one of the excel files he got a few months ealier. so that the customers were annoyed that they were being called again.
He asked me if i could help him out somehow. So I thought I would build a program which saves all phones in a text file named STORED.txt:
It has 2 cases:
1.if STORED.txt is empty:
Add each phone of the excel file to STORED.txt.
ELSE if STORED.txt is not empty:
for each phone in the excel - check if it already exists in STORED.txt.
The problem with this approach, is that after many runs, the STORED.txt file already has millions of values, and then a new excel file entered with 100,000 values would have to run over (100,000*millions) of iterations, which makes for an enormous runtime.
I'm wondering if there's a better approach to this issue, not going through O(S*E) complexity (where S are the stored phones and E are the new Excel phones). Any ideas?
BTW, when reading the text file, I'm first storing all the values into a java ArrayList(O(S) time) and only then checking for each phone in the excel if it exists in the ArrayList, using the java ArrayList.contains(value) method. I wonder if it's an efficient way, or maybe there's a way to do it which would be less time-consuming.
Any suggestions would be very welcome. Thanks!
I am using jasper Reoprt Ireport 3.0 for Generating excel. my problem is I have One text field in that i want to keep below data which is coming from my database.
**Disclaimer: Please note that in case of disease conditions which can have both Acute and Chronic manifestations, they are considered as Chronic illness for analysis keeping in view the objective of the report.
Actually in jasper reoprt summary area i have given one text field but it is too small too keep this above line data. but still I want to keep whole data in small field in excel .
because normaly when we are typing in excel cell anything and when it become overflows then also it's looking like it has been typed in next cell but ,when we are clicking in another cell it will show in that cell only.whole data will come in that small cell without wrapping text filed.
just like it i want also through I-report 3.0 . I tried so much but I didn't find solution so i am posting here . please suggest if you faced same problem and got solution too. it will be helpful.
I don't want to merge it in multiple columns because if it will merge multiple columns then for calculating value through Excel column selection will be a problem. and V lookup we cant do so.
if the data in any cell is greater than 2 rows, then the remaining data just gets cut off and not displayed.
Maybe it is time to update. At this time JasperReports 6.x is the version to go, but ...
From my expierience JasperReports is the wrong tool to generate "clean" Excel documents. You get always layout informations in it that result in the behaviour you describe.
To get a clean Excel document I would suggest to go with Apache-Poi (https://poi.apache.org/) and generate it directly or simply to generate a CSV - file which can be easily opened using Excel.
I'm using Apache POI to modify an existing Excel file (something.xls).
After I set a cell value using:
sheet.getRow(3).getCell(30).setCellValue(222);
I can see the changes reading the value from the same cell with:
sheet.getRow(3).getCell(30).toString();
BUT when I'm opening the something.xls file with MS Excel the change is gone.
Now the funny part:
-If I'm rerunning the code without the line where I set the cell value, I can still see 222, so the change is there, only I see the
old value from MS Excel for some reason.
-I triple checked to make sure I'm not editing a different file from code and opening another with Excel.
-I tried changing some other random cells in a similar way and some work, while others do not. (the cells do not contain formulas and all
are numeric type)
I would really appreciate if anyone could offer an explanation and solution.
Thanks in advance.
I copied the contents of the existing excel file (manually, without any formatting) to a new one and formatted it again. It is working now. I must have set something wrong the first time, I couldn't figure out what though. Thanks for the replies.
I already have a ui that collects all the information I need to print over a Pre-printed paper (invoices). And I need to print collected informacion in specific places of the paper. So far I've been generating from the program, an excel file that is used for this purpose. I would like to know if there is a way to avoid the excel file, and print directly from the ui.
Thanks in advance.
I have a huge amount of data which I would like to stream row by row. I thought calling workbook.write(stream) after changing the value of each row would append each write onto the output stream, but I was wrong. As it is, the file size suggests/matches the amount of rows I have, but there is only 1 row inside the file itself (which is the first row written).
Is there a way to accomplish this? Much like I would be able to using a text file?
I've taken a look at the BigGrid implementation, and it looks a bit overkill for what I'm trying to do.
Thanks!
You can't do a streaming write of the whole file in one go, the file format doesn't work like that. There are references between different parts of the file that preclude it. The file format just isn't like a CSV!
Instead, what you can do is hold a few small parts in memory, do a streaming write of the large parts of the spreadsheet to a temporary file, then re-assemble it in a low memory manner for output. To do that, look at the (fairly new) SXSSF usermodel code in POI.