//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); // Set worksheet layout and data IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["B:C"].ColumnWidth = 15; worksheet.Range["D:G"].ColumnWidth = 20; worksheet.Range["4:7"].RowHeight = 60; worksheet.Range["A:A"].ColumnWidth = 5; worksheet.Range["B2"].Value = "EAN-13"; worksheet.Range["B2:F2"].Merge(true); worksheet.Range["B3:G3"].Value = new object[,]{ {"Name", "Number", "Default", "Change addOn", "Change addOnLabelPosition", "Explain"} }; worksheet.Range["B4:C7"].HorizontalAlignment = HorizontalAlignment.Center; worksheet.Range["B4:C7"].VerticalAlignment = VerticalAlignment.Center; worksheet.Range["B2:F3"].HorizontalAlignment = HorizontalAlignment.Center; worksheet.Range["B2:F3"].VerticalAlignment = VerticalAlignment.Center; worksheet.Range["B4:C6"].Value = new object[,] { {"Medicine", "692031229621"}, {"Pen", "6945091701532"}, {"value length is 13", "8142486545683"} }; worksheet.Range["G6"].Value = "No EAN-13 generated, because the last digit is check-sum digit and it is invalid"; worksheet.Range["G6"].Font.Color = Color.Red; worksheet.Range["B4:C6"].WrapText = true; worksheet.Range["G6"].WrapText = true; worksheet.PageSetup.Orientation = PageOrientation.Landscape; worksheet.PageSetup.PrintGridlines = true; // Set formula for (var i = 4; i < 7; i++) { worksheet.Range["D" + i].Formula = "=BC_EAN13" + "(C" + i + ")"; worksheet.Range["E" + i].Formula = "=BC_EAN13" + "(C" + i + ",,,,,22)"; worksheet.Range["F" + i].Formula = "=BC_EAN13" + "(C" + i + ",,,,,22,\"bottom\")"; } // Save to a pdf file workbook.Save("EAN13.pdf");
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) 'set worksheet layout And data worksheet.Range("B:C").ColumnWidth = 15 worksheet.Range("D:G").ColumnWidth = 20 worksheet.Range("4:7").RowHeight = 60 worksheet.Range("A:A").ColumnWidth = 5 worksheet.Range!B2.Value = "EAN-13" worksheet.Range("B2:F2").Merge(True) worksheet.Range("B3:G3").Value = New Object(,) { {"Name", "Number", "Default", "Change addOn", "Change addOnLabelPosition", "Explain"}} worksheet.Range("B4:C7").HorizontalAlignment = HorizontalAlignment.Center worksheet.Range("B4:C7").VerticalAlignment = VerticalAlignment.Center worksheet.Range("B2:F3").HorizontalAlignment = HorizontalAlignment.Center worksheet.Range("B2:F3").VerticalAlignment = VerticalAlignment.Center worksheet.Range("B4:C6").Value = New Object(,) { {"Medicine", "692031229621"}, {"Pen", "6945091701532"}, {"value length is 13", "8142486545683"}} worksheet.Range!G6.Value = "No EAN-13 generated, because the last digit is check-sum digit and it is invalid" worksheet.Range!G6.Font.Color = Color.Red worksheet.Range("B4:C6").WrapText = True worksheet.Range!G6.WrapText = True worksheet.PageSetup.Orientation = PageOrientation.Landscape worksheet.PageSetup.PrintGridlines = True For i = 4 To 7 - 1 worksheet.Range("D" & i).Formula = "=BC_EAN13" & "(C" & i & ")" worksheet.Range("E" & i).Formula = "=BC_EAN13" & "(C" & i & ",,,,,22)" worksheet.Range("F" & i).Formula = "=BC_EAN13" & "(C" & i & ",,,,,22,""bottom"")" Next ' save to a pdf file workbook.Save("EAN13.pdf")