//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet sheet = workbook.Worksheets[0]; int row = 50; int column = 14; object[,] data = new object[row, column]; for (int i = 0; i < row; i++) { for (int j = 0; j < column; j++) { data[i, j] = "R" + i + "C" + j; } } //Set data sheet.Range["A1:N50"].Value = data; //Set paper size sheet.PageSetup.PaperSize = PaperSize.A5; //With API the margin's unit is pound, with Excel the margins display unit is inch. //One inch eaquals to 72 pounds. If the top margin is 0.8 inch, then please set PageSetup.TopMargin = 0.8*72(57.6); sheet.PageSetup.TopMargin = 57.6; //Top margin in excel is 0.8 inch sheet.PageSetup.BottomMargin = 21.6; sheet.PageSetup.LeftMargin = 28.8; sheet.PageSetup.RightMargin = 0; sheet.PageSetup.HeaderMargin = 0; sheet.PageSetup.FooterMargin = 93.6; // Save to a pdf file workbook.Save("ConfigurePagination.pdf");
' Create a new Workbook Dim workbook As New Workbook Dim sheet As IWorksheet = workbook.Worksheets(0) Dim row As Integer = 50 Dim column As Integer = 14 Dim data(row - 1, column - 1) As Object For i As Integer = 0 To row - 1 For j As Integer = 0 To column - 1 data(i, j) = "R" & i & "C" & j Next j Next i 'Set data sheet.Range("A1:N50").Value = data 'Set paper size sheet.PageSetup.PaperSize = PaperSize.A5 'With API the margin's unit is pound, with Excel the margins display unit is inch. 'One inch eaquals to 72 pounds. If the top margin is 0.8 inch, then please set PageSetup.TopMargin = 0.8*72(57.6) sheet.PageSetup.TopMargin = 57.6 'Top margin in excel is 0.8 inch sheet.PageSetup.BottomMargin = 21.6 sheet.PageSetup.LeftMargin = 28.8 sheet.PageSetup.RightMargin = 0 sheet.PageSetup.HeaderMargin = 0 sheet.PageSetup.FooterMargin = 93.6 ' save to a pdf file workbook.Save("ConfigurePagination.pdf")