Free Support Forum - aspose.com

Invalid row height

Hi!

I’ve been testing Aspose.Cells for Java, versions 2.0.0 and 2.1.1.
It seems my Excel spreadsheet can not be read, I keep getting the following error:

Exception in thread “main” java.lang.IllegalArgumentException: Invalid
row height: 8192. Row height must be between 0 and 8180 twips.

at com.aspose.cells.cG.f(Unknown Source)

at com.aspose.cells.Cells.a(Unknown Source)

at com.aspose.cells.eJ.b(Unknown Source)

at com.aspose.cells.eJ.a(Unknown Source)

at com.aspose.cells.Workbook.a(Unknown Source)

at com.aspose.cells.Workbook.a(Unknown Source)

at com.aspose.cells.Workbook.open(Unknown Source)

at com.aspose.cells.Workbook.open(Unknown Source)
Unfortunately, I can not attach the incriminated workbook to this forum because it contains some confidential business data.

It seems that MS Excel can save rows with an height of 8192 but Aspose.Cells is limited to 8180.

Would there be a workaround? Or is this a bug?

Regards.

Hi,

Thank you for considering Aspose.

Well, I tested your issue with the attached latest version of Aspose.Cells (attached) and was not able to reproduce the issue. As your file has some confidential data, you may check “Keep this post private” while replying to the post and only you and Aspose Staff will be able to see your post. Alternately, you can also send us your template file via email. Please follow the below mentioned steps to send us the file via email.

1: click the Contact button in the Post.

2: In the drop down list options click "Send nausherwan.aslam an Email”.

3: Attach the template file and send it.

4: Once you have done it, kindly confirm us on this thread.

Thank You & Best Regards,

Hi,

Following is the source code I am executing. Its purpose is to saving into a PDF one of the sheets of an XLS workbook:

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;

import com.aspose.cells.FileFormatType;
import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import com.aspose.pdf.elements.DestinationType;
import com.aspose.pdf.elements.Pdf;

public class ExcelToPdf {

public static void main (String[] args) {
if (args.length < 2) {
System.err.println(“2 arguments needed: fileName, sheetName”);
System.exit(0);
}
new ExcelToPdf().run(args[0], args[1]);
}

public void run(final String fileName, String sheetName) {
Workbook sourceWb = new Workbook();
try {
sourceWb.open(fileName);
}
catch (IOException ioe) {
throw new RuntimeException("Could not open file: " + fileName, ioe);
}

Worksheet sourceWs = sourceWb.getWorksheets().getSheet(sheetName);

final Workbook workWb = new Workbook();
Worksheet workWs = workWb.getWorksheets().addSheet();
workWs.copy(sourceWs);

final PipedInputStream in = new PipedInputStream();
PipedOutputStream outTemp;
try {
outTemp = new PipedOutputStream(in);
}
catch (IOException ioe) {
throw new RuntimeException(“Error”, ioe);
}
final PipedOutputStream out = outTemp;

new Thread() {
public void run() {
try {
workWb.save(out, FileFormatType.ASPOSE_PDF);
}
catch (IOException ioe) {
throw new RuntimeException(“Error”, ioe);
}
}
}.start();

new Thread() {
public void run() {
Pdf pdf;
try {
pdf = Pdf.bindXML(in);
}
catch (Exception e) {
throw new RuntimeException(“Error”, e);
}
pdf.setDestinationType(DestinationType.FitWidth);
try {
pdf.save(new FileOutputStream(fileName + “.pdf”));
}
catch (Exception e) {
throw new RuntimeException("Could not save file: " + fileName + “.pdf”, e);
}
}
}.start();
}
}
It does not work either with the last version you have attached.

If I save the same file using the .xlsx format, then the problem disappears. But I would like to be able to use .xls documents (MS Office 2003).

I have sent you an email with an attached workbook. I have stripped out all the confidential and unrelated data, and kept the minimal. Sheet A is the one provoking the issue. Sheet B is the one to be exported to PDF.

Regards
Vincent

Hi,

Thank you for considering Aspose.

We have received your template file via email. We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our issue tracking system with issue id CELLSJAVA-12105.

Thank You & Best Regards,

Hi,

Please try attached fix, we have fixed the issue of reading row height.

Hi.

Thank you, the problem with invalid row height seems to be solved in this version.

Now, I have another problem. When the Excel spreadsheet contains an EMF object, the conversion to PDF fails with the following stacktrace:

Exception in thread “Thread-1” java.lang.RuntimeException: Could not save file: bug.xls.pdf
at ExcelToPdf$2.run(ExcelToPdf.java:74)
Caused by: com.aspose.pdf.exception.AsposeIOException: error in read image
at com.aspose.pdf.elements.ImageInfo.e(Unknown Source)
at com.aspose.pdf.elements.Image.a(Unknown Source)
at com.aspose.pdf.elements.Cell.g(Unknown Source)
at com.aspose.pdf.elements.Table.a(Unknown Source)
at com.aspose.pdf.elements.Section.a(Unknown Source)
at com.aspose.pdf.elements.Pdf.a(Unknown Source)
at com.aspose.pdf.elements.Pdf.a(Unknown Source)
at com.aspose.pdf.elements.Pdf.save(Unknown Source)
at ExcelToPdf$2.run(ExcelToPdf.java:71)
I assume this is an Aspose.PDF issue, so I will post in the right forum.

Thanks

The issues you have found earlier (filed as 12105) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.