I have uploaded Excel sheet data (office 2007 version) and it is correctly inserted in MYSQL. When I am fetching it on JSP page it is not displayed and I didn't get any error. While data before uploading excel sheet is properly displayed. And when I delete those data coming from Excel sheet, then it is again OK.
How to overcome this problem?
It could be that via Excel you put text in wrong encoding in MySQL. Then Java would throw an Exception if a byte sequence is illegal. This can be the case if Java expects UTF-8, or the database field contains Excel with UTF-16 (byte pairs). To diagnose this, upload an Excel with pure ASCII. If you see that, UTF-8 is guilty.
To repair, ensure that the database/table/field is UTF-8.
Related
I am using aspose-cells-8.7.2-java. When I refresh the pivot table and save it, the excel file is getting corrupted. When I try to open the excel file I am getting the alert message as below :
"Excel found unreadable content in 'Book1.xlsx'.Do you want to recover the contents of this workbook?If you trust the source file of this workbook, click yes."
The code is as below :
Workbook wb = new Workbook("Book1.xlsx");
PivotTable pt = wb.getWorksheets().get(1).getPivotTables().get(0);
pt.refreshData();
pt.calculateData();
wb.save("Book1.xlsx");
Any help ?
I found this thread where the same issue is logged as a ticket :
http://www.aspose.com/community/forums/thread/683715/aspose.cells-generates-a-corrupted-xlsx-file-excel-2007-fails-to-open.aspx.
Is this issue solved?
I'm afraid the logged issue is not resolved yet. By the way, do you use similar Excel file or yours template file "Book1.xlsx" is different. Moreover, your issue can be template specific (if you are using different file) and might have different scenarios, so we need your template "Book1.xlsx" file to properly evaluate your issue on our end. We recommend you to kindly create a separate thread in Aspose.Cells forum with your template Excel file, we will evaluate your issue and help you better there.
I am working as Support developer/ Evangelist at Aspose.
Is there any way wherein I can read data from an Excel file(from a Column) change the I/P of the Column Value in a HTTPS URL and then fetch the value from the Web Page and feed the I/P corresponding to the Row in another column which can be used in Shell.
I have googled and found that we can use Selenium and Apache POI to read and write into the Excel however how do I read the data from the Web Page.
You can use node.js to fetch data on the web.
then you use node module
https://www.npmjs.com/package/excel-export
to make it as an excel sheet or
https://www.npmjs.com/package/node_spreadsheet
I am reading encoded data from database. When I decode data I get something like
%PDF-1.3
23 Obj
xref
10000000 123n
.
.
.
.
%EOF
I am guessing it's a metadata of PDF file with data. My question is how do I create PDF file out of this with readable data only.
Thanks in advance.
First you need to know what the data in DB represents. I would suggest to connect to the database using a general client. For example, for Oracle - SqlDeveloper, for MS Sql Server - Visual Sql Server, etc
Display the table which has a column of type long, clob or blob and try to save it to a file. Name the file with an extension .pdf. Try to open the saved file and see if it gets open correctly by a pdf reader.
If this is a case, saving it from Java is trivial. For example: http://www.astral-consultancy.co.uk/cgi-bin/hunbug/doco.cgi?11120
I am trying to read data from a xls which is working fine using
java.io.File f1=new java.io.File("E:/SELENIUM DATA/First_P1/DATA_SHEET.xls");
w = Workbook.getWorkbook(f1);
wworkbook = Workbook.createWorkbook(f1,w);
after some time , if try to open xls , showing file is corrupted. help me.
By looking into your small piece of code it seems you are not following the correct way to read the excel sheet. If you just want to read the excel sheet then there is no need to use createWorkbook(f1,w) or If you want to write something on it then you must be doing something wrong that's why it corrupts your file.
Read/Write Excel sheet
The file should be closed properly once the data read/write from the sheet so that
the mentioned error message will not be prompted.
You can use below commands like
w.write();
w.close();
First of all thanks for the previous help.
What I want to do is the following.
Is to collect information through a small program that can capture in Java and writes it to a file which I have done.
Then to have this information passed to a preformatted excel spread sheet.
In the spread sheet it reads this data that is written and displays it in different tables and graphs.
Is this possible to automatically code or do I have to write to a csv file, from the csv file manually copy to an excel template?
If anybody has come across a solution to my problem I would appreciate a steer in the right direction
Hey try ths code in servlet or in JSP.
This will convert simple excel sheet on which you can do further operations..
response.setContentType("application/vnd.ms-excel");
PrintWriter out = response.getWriter();
try {
out.println("\tId \tName");
out.println("\t1\tabc");
out.println("\t2\txyz");
out.println("\t3\tpqr");
} finally {
out.close();
}
here ..
response.setContentType("application/vnd.ms-excel");
specify the excel sheet to be generated..
all "\t" separates new cell in the excel sheet.
On your requirement basis you can also change this code with database or any...
It's a duplicate of How to read and write excel file in java
you can use this API: http://poi.apache.org/
Or if you write one text file with tab separation between fields and save with (.XLS) extension, excel should read it. But off course the better solution is to use Apache POI HSSF.