The preview page break excel

Hi,

i need to know the code vb.net or c # to set the area of ​​the print preview area.
I would also code to hide columns in excel.
attached PrintPreview and ResultPrintPreview(desired result)


thanks

Hi,


See the sample code for your reference for your needs:
e.g
Sample code:
Workbook excel = new Workbook();
Worksheet sheet1 = excel.Worksheets[0];
for (int i = 0; i < 14; i++)
{
for (int j = 0; j < 3; j++)
{

sheet1.Cells[i, j].PutValue(i.ToString() + “,” + j.ToString());

}

}

int maxCol = sheet1.Cells.MaxDisplayRange.ColumnCount-1;
int maxRow = sheet1.Cells.MaxDisplayRange.RowCount-1;


//Obtaining the reference of the PageSetup of the worksheet
Aspose.Cells.PageSetup pageSetup = sheet1.PageSetup;
pageSetup.PrintGridlines = true;
pageSetup.PrintArea = “A1:” + CellsHelper.CellIndexToName(maxRow, maxCol);


sheet1.IsPageBreakPreview = true;

excel.Save(“e:\test2\testpagebreaks1.xlsx”);

Hope, this helps a bit for your requirements.

Thank you.