I am trying to generate excel and pdf with merged cells and using method AutoFitRows and the AutoFitColumns. But the data in excel sheet is getting truncated/overflown on top and bottom. And When converted to pdf. For some languages like english it is printing the text in completely in pdf, but for other language data is getting trunctated in pdf on top and bottom of the cell. Same exact method is used in both languages.
image.png (7.5 KB)
image.png (2.3 KB)
image.png (61.3 KB)
@PramodHegde
Thank you for your feedback. We can obtain the correct results by testing the following sample code on the latest version v24.3. Please refer to the attachment. result.zip (149.1 KB)
AutoFitterOptions.OnlyAuto indicates whether only fit the rows which height are not customed.
The sample code as follows:
Workbook wb = new Workbook(filePath + "English_AutoFit.xlsx");
AutoFitterOptions options = new AutoFitterOptions();
options.AutoFitMergedCellsType = AutoFitMergedCellsType.EachLine;
options.AutoFitWrappedTextType = AutoFitWrappedTextType.Paragraph;
options.MaxRowHeight = int.MaxValue;
//please comment this line
//options.OnlyAuto = true;
Worksheet sheet = wb.Worksheets[0];
sheet.AutoFitRows(options);
sheet.AutoFitColumns(options);
wb.Save(filePath + "English_AutoFit_out.pdf");
wb = new Workbook(filePath + "Japanese_AutoFit.xlsx");
sheet = wb.Worksheets[0];
sheet.AutoFitRows(options);
sheet.AutoFitColumns(options);
wb.Save(filePath + "Japanese_AutoFit_out.pdf");
Hope helps a bit.
Update - Commenting the OnlyAuto flag worked for me. Thanks !
Good to know that commenting or removing the suggested line of code works for your needs. Please feel free to contact us at any time if you have further queries or issues, and we will be happy to assist you soon.