When we are converting excel to pdf, we are using the following code to set print area.
public static void SetPrintArea(Workbook workbook, int maxCol, int maxRow)
{
foreach (Worksheet sheet in workbook.Worksheets)
{
maxCol = sheet.Cells.MaxColumn;
maxRow = sheet.Cells.MaxRow;
if (sheet.Cells.MaxDataColumn - 1 > sheet.Cells.MaxColumn)
maxCol = sheet.Cells.MaxDataColumn - 1;
if (sheet.Cells.MaxDataRow - 1 > sheet.Cells.MaxRow)
maxRow = sheet.Cells.MaxDataRow - 1;
if (sheet.Cells.MaxDisplayRange.ColumnCount - 1 > maxCol)
maxCol = sheet.Cells.MaxDisplayRange.ColumnCount - 1;
if (sheet.Cells.MaxDisplayRange.RowCount - 1 > maxRow)
maxRow = sheet.Cells.MaxDisplayRange.RowCount - 1;
if (maxCol > 0 && maxRow > 0)
{
Aspose.Cells.PageSetup pageSetup = sheet.PageSetup;
pageSetup.PrintArea = "A1:" + CellsHelper.CellIndexToName(maxRow, maxCol);
}
}
}
But we have a problem now. I attached original file and screenshot for you.
When we are convert attached excel file to pdf, table is moving the left side.
Could you please check it ?
Before, we asked you similar issue. You can find to links at below.
<a href="https://forum.aspose.com/t/108260</a></div><div><br></div><div><br></div>