Save to PDF does not preserve column formatting

Attached is an XLS file that contains data in 2 columns, E & J. The size of column E is very small (1.29) but contains text that is bigger than the column width. Columns F, G, and H are hidden and then there is text in Column J. Everything looks fine in Excel however, when I save the file as PDF from Aspose.Cells, the PDF file does not look like the Excel file. The large amount of text in column E is displayed and is overlapping the text in Column J instead of getting cut off to the size of Column E.


Can this be fixed?

I have attached both the Xls file and the Pdf file that was produced for your reference.

Harry
Clarity Systems

Hi Harry,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file.

We have found your mentioned issue after an initial test. Your issue has been registered in our internal issue tracking system with issue id: CELLSNET-16805. We will look into it and get back to you soon.

Thank You & Best Regards,

Hi,

Please try the attached version, we have resolved your issue.

Thank you.

The fix appears to be working.

Thank you for the quick response.

Harry

Unfortunately, this fix broke something else. Now, when I make a call to worksheet.GetPageCount
I get an Object reference not set to an instance of an object error. If I revert back to an older dll, this error does not happen.

Can this be fixed?

Hi,

Could you post your template file with sample code to reproduce the issue, We will check it soon.

Thank you.

Unfortunately, for some reason I cannot reproduce this issue outside of our application with a sample template file and sample code.

I will continue to try to replicate the problem in a sample app that I can send you but in the meantime if you can somehow investigate what might be causing the error, that would be great.

The error I am getting is “Object reference not set to an instance of an object.” when calling the GetPageCount method of the worksheet object.

Thanks

Harry

Hi,

Well, “Object reference not set…” error has many applications, so, we cannot know why you are getting this error in your application. We cannot reproduce the issue on our side. We appreciate if you could provide us the demo application to reproduce the issue, so that we may look into it soon.

By the way, you can use Worksheet.GetPrintingPageBreaks instead if it fits your requirements.

Thank you.

I will try to replicate the issue in a demo application.

As for the GetPrintingPageBreaks method. How do I use it? Can it help me determine the page count for each worksheet?

Thanks

Harry

Hi,

Yes, sure you can use this API to get the page count for a worksheet.

See the sample code below:
Workbook workbook = new Workbook();
workbook.Open(“e:\test\book1.xls”);
Worksheet worksheet = workbook.Worksheets[0];
//Add dynamic page breaks, these page breaks are taken care too.
///workbook.Worksheets[0].VPageBreaks.Add(6, 10);
///workbook.Worksheets[0].VPageBreaks.Add(100, 11);
ImageOrPrintOptions printoption = new ImageOrPrintOptions();
printoption.PrintingPage = PrintingPageType.Default;
SheetRender sr = new SheetRender(worksheet, printoption);
int pageCount = sr.PageCount;
MessageBox.Show(pageCount.ToString());




CellArea[] area = worksheet.GetPrintingPageBreaks(printoption);
MessageBox.Show(area.Length.ToString());
//Get the first page rows.
int strow = area[0].StartRow;
int stcol = area[0].StartColumn;

int numrows = area[0].EndRow - strow + 1;
int numcols = area[0].EndColumn - stcol + 1;

MessageBox.Show(area.Length.ToString());


Thank you.

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


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

While trying to keep the API as straightforward and clear as possible, we have decided to recognize and honor the common development practices of the platform; we have re-arranged API Structure/ Namespaces.

With this release, we have reorganized the API classes for Aspose.Cells component. This change has some major aspects that we follow. We have added new namespaces. The entire API (classes, interfaces, enumerations, structures etc.) were previously located in the Aspose.Cells namespace. Now, certain sets of API have been moved to their relative namespaces, which make the relationship of classes (with their members) and namespaces clear and simplified. It is to be noted here, we have not renamed existing API (classes, enumerations etc.) but, I am afraid you still need to make certain adjustments in your existing projects accordingly.

For complete reference, please see the product's API Reference.