//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); var fileStream = this.GetResourceStream("xlsx\\PageSetup Demo.xlsx"); workbook.Open(fileStream); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["C3"].Value = "The page numbers and the total page numbers are added by 1."; // Set page headerfooter. // Use &P+1 to display the page number plus one. // Use &N+1 to display the total page number plus one. worksheet.PageSetup.RightHeader = "Page header example, &P+1 of &N+1 "; // Save to a pdf file workbook.Save("ConfigHeaderPageNumberCalc.pdf");
' Create a new Workbook Dim workbook As New Workbook Dim fileStream = GetResourceStream("PageSetup Demo.xlsx") workbook.Open(fileStream) Dim worksheet = workbook.Worksheets(0) worksheet.Range("C3").Value = "The page numbers and the total page numbers are added by 1." ' Set page headerfooter. ' Use &P+1 to display the page number plus one. ' Use &N+1 to display the total page number plus one. worksheet.PageSetup.RightHeader = "Page header example &P+1 of &N+1 " ' save to a pdf file workbook.Save("ConfigHeaderPageNumberCalc.pdf")