new & interesting places for your GPS

Formatting Error While Reading Excel File using POI 2.5 Final Related

 

Hi All,

I am using poi-2.5-final-20040302.jar for my project to create excel files.
My system is having Microsoft Excel 2002 (SP-2) version, but my client is having Microsoft Office Excel 2003 (SP-3).
My problem is that I can download the excel file with no formatting issues , but client is not able to download the same and is getting error as
"Damage to the file was so extensive that repairs were not possible.Excel attempted to recover your formulas and values, but some data might have been lost or corrupted".

After getting above error message, they can open the file but the colours,fonts ie formatting will be lost and only data will be available in excel.

Can anyone help how to sort out ths issue.

Thanks in Advance,
Ravi

Excel versions

ravipn2005 wrote:

My system is having Microsoft Excel 2002 (SP-2) version, but my client is having Microsoft Office Excel 2003 (SP-3).

After getting above error message, they can open the file but the colours,fonts ie formatting will be lost and only data will be available in excel.

I've got a feeling that I don't understand the problem so a few simple questions:

Where is the file coming from that is causing you the trouble....and/or what specific file is it ??

A file created with Excel 2002 should be readable by the 2003 version.

If you are dealing with a POI file, the data is all that really matters so why is loss of colors or fonts a problem ??

--
Magellan Maestro 4250// MIO C310X

Re: Formatting Error While Reading Excel File using POI 2.5 Fina

Thanks for ur reply.

The excel file is generated using POI API from our Application.It is a .xls file.

The excel file is readable by both versions Excel 2002 and Office 2003.

In excel 2002 i am able to see the formatted data ie I have written code in my application using poi api to set font style using code as below:

HSSFCellStyle totStyle;
HSSFCell c = null;
HSSFRow r = null;

FileOutputStream out = new FileOutputStream( EPRReportConstant.tempReportPath+fName);
wb = new HSSFWorkbook();
// create a new sheet
s = wb.createSheet();
s.setDefaultColumnWidth((short)14);

totStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("#,##0.00"));
totStyle.setBorderBottom(totStyle.BORDER_THIN);
totStyle.setBorderTop(totStyle.BORDER_THIN);
totStyle.setBorderLeft(totStyle.BORDER_THIN);
totStyle.setBorderRight(totStyle.BORDER_THIN);
totStyle.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
totStyle.setFillForegroundColor(new HSSFColor.GREY_25_PERCENT().getIndex());
totStyle.setFont(f10Bold);

totStyle = wb.createCellStyle();

// Set title of the report
r = s.createRow((short)rownum);
c = r.createCell((short)0);
c.setCellValue("PAYROLL DETAIL REPORT FOR MONTH - "+EPRConstantUtil.getMonths(Integer.parseInt(payMonth))+" , YEAR - "+payYear+"");
c.setCellStyle(titleStyle);

I am able to see the formatted excel file using above code.

But when we are using Office 2003 and downloading the same excel file via our application ,I am not able to see the formatting.

For us data is coming in both excel versions. But formatting is also our requirement.

Hope u understand my problem.

Thanks,
Ravi

.

Does this have something to do with Custom POI files for GPS units?

Either I'm missing that or you have stumbled onto the wrong website.

Try http://jakarta.apache.org/

I think that you are asking about the Jakarta POI project for manipulating various file formats such as Excel via a java program. You are on a site for POI's (Places of Interest) for GPS units.

Try http://jakarta.apache.org/ or some Microsoft and java forums. You will get more meaningful answers there.

--
I plan to live forever. So far, so good.

POI in an Excel File?

Seems to me that trying to put POI into a Excel file would be very hard not to also say very messy! I suppose the 1 finger POI might be less mesy than 2 finger POI but just the same it seems messy.

Just a thought.

H Hannah
Nuvi750 and Ique3600

--
"Those that stop and smell the roses, must realize that once in awhile you may get a whiff of fertilizer."......................copyright:HDHannah1986 .................................... H Hannah-Nuni2555 - Nuvi855 - Nuvi295W - Nuvi750 and Ique3600

No Programmers here

ravipn2005 wrote:

The excel file is generated using POI API from our Application.It is a .xls file.

And no Excel "experts" either.

You have come to the wrong place for help with your problem.

You probably need to contact the "makers" of the API.

If you are trying to produce POI files that are readable by GPSr units, you might want to consider creating something in a different format. I know of NO units that can read a native .xls file.

--
Magellan Maestro 4250// MIO C310X

There are several

There are several "programmers" here. I'm one of them. But this is the wrong forum for such topics. smile

--
nüvi 200

Plenty of Programmers here

and some Excel experts, but he was working on a Payroll report from the snippets of code he had here. The POI that he was referencing had nothing to do with GPS, but with a particular programming effort that uses those same initials.

--
I plan to live forever. So far, so good.

Oops!

dr5274 wrote:

There are several "programmers" here. I'm one of them. But this is the wrong forum for such topics. smile

OK, so I over-simplified a bit. Sorry.

At least I got part of it right: Contact the author(s) of the API.

--
Magellan Maestro 4250// MIO C310X

no offense here

ka1167 wrote:
dr5274 wrote:

There are several "programmers" here. I'm one of them. But this is the wrong forum for such topics. smile

OK, so I over-simplified a bit. Sorry.

At least I got part of it right: Contact the author(s) of the API.

so no apology is necessary smile

--
nüvi 200

sponsored links