I am using cells to convert an excel document to a PDF. As part of the conversion I set the columns to Autofit the text. When I call auto fit on a worksheet that has long text int it the text it cut off and not included in the pdf. I tried changing some options but nothing seems to work. Is this a bug?
Files.zip (35.0 KB)
Here is an example of the code and I attached the excel doc, the actual and expected results:
Workbook workbook = new Workbook(@"d:\input\AutoFit.xlsx");
foreach(var sheet in workbook.Worksheets)
{
sheet.AutoFitColumns();
}
PdfSaveOptions options = new PdfSaveOptions();
workbook.Save(@"d:\output\Expected.pdf", options);
We were able to observe this issue and logged it in our database for investigation and for a fix. Once, the issue is resolved or we have some other news for you, we will update you asap.
This issue has been logged as
CELLSNET-45698 - Worksheet.AutoFitColumns method cuts off the long text while rendering to Pdf
The long text is too long, when you autofit column, the column width is larger than the page width, in this case, the text is clipped.
Microsoft Excel has the similar issue when you have data in cell B1 (in your file), then autofit column A, you can see the text is clipped in the output/print preview.
Excel does the same thing, but it prints the content on the next pages.
When I auto fit the column using aspose cells the 2 additional pages are missing. Even if the column width is set from excel the content is still missing when saved to pdf from aspose.
I have attached a sample file with the columns width already set and output from excel and aspose. The aspose code was simply this:
Workbook workbook = new Workbook(file);
PdfSaveOptions options = new PdfSaveOptions();
workbook.Save(@"d:\output\output.pdf", options);
We know Microsoft Excel prints the content to next pages. But if you could print gridlines and headings (see my attachment “print_gridlines_headings.png”), in the printview, you will find Microsoft Excel actually prints the content to Columns B, C, …(see my attachment “printview.png”), although the content should be in Column A totally. So as we said Microsoft Excel also has the text being clipped issue if Cell B1 has data as we told you in the last post.
print_gridlines_headings.png: print_gridlines_headings.png (68.0 KB)
The issues you have found earlier (filed as CELLSNET-45698) have been fixed in Aspose.Cells for .NET v19.4. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.