Aspose cells column widths are not same so text is not wrapped


With this excel we are facing text warp issue, please check these files
Aspose cells column widths are not same so text is not (217.2 KB)

Note: Ignore the last highlighted comment, footer is added in the 2nd sheet thats why it is rendered in converted PDF.

The row height stored in your template file is not the same as displayed in MS Excel and row height is automatic.

  1. Please re-save the file with MS Excel to change the stored row height.
  2. Please call Worksheet.AutoFitRows as the following codes:
Workbook workbook = new Workbook(dir + "PRV-PA-ITP-00004.xlsx");
AutoFitterOptions options = new AutoFitterOptions();
options.OnlyAuto = true;
workbook.Save(dir + "dest.pdf");

The first solution, re-save the file is to resolve the alignment of the paragraph in 2nd sheet? Because the AutoFitRows solves the first sheet issue of word wrap, on file resave as well the paragraph alignment is not same as native.


We tested and there is no alignment issue regarding paragraphs in the second sheet. Please take the print preview of the second sheet in MS Excel manually and then compare with output PDF page (by Aspose.Cells). You will notice both are same. See the screenshot attached.
sc_shot1.png (203.8 KB)


For comparing text wrap, please compare Aspose.Cells generated pdf with Excel manually saved pdf(or the resutl in Excel printview). I checked the result file with your new code, everything is OK now.

  // Save the document in PDF format
  Workbook workbook = new Workbook("PRV-PA-ITP-00004.xlsx");
  WorksheetCollection col = workbook.getWorksheets();
  PdfSaveOptions opt = new PdfSaveOptions();
 // opt.setOnePagePerSheet(true);  // Not using this setting
  for (int i=0; i<col.getCount(); i++) {
      Worksheet sheet = workbook.getWorksheets().get(i); 
      PageSetup pSetup = sheet.getPageSetup();
  }"output.pdf", opt);

Please let us know your feedback.

Thank you for your response. We can close this.


You are welcome. We have closed the ticket.