The sample shows instructions and algorithm of how to merge cells and set alignment with spreadsheet sdk and how to make it run in your VBScript application. What is ByteScout Barcode Suite? It is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK). It can help you to merge cells and set alignment with spreadsheet sdk in your VBScript application.
Want to save time? You will save a lot of time on writing and testing code as you may just take the VBScript code from ByteScout Barcode Suite for merge cells and set alignment with spreadsheet sdk below and use it in your application. This VBScript sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout Barcode Suite in VBScript is also described in the documentation included along with the product.
ByteScout provides the free trial version of ByteScout Barcode Suite along with the documentation and source code samples.
Set document = CreateObject("Bytescout.Spreadsheet.Spreadsheet") document.RegistrationName = "demo" document.RegistrationKey = "demo" ' Add new worksheet Set worksheet = document.Workbook.Worksheets.Add("HelloWorld") ' change width of the column #1 set column = worksheet.columns.Item(1) column.Width = 200 ' change height of row #1 set row = worksheet.rows.Item(1) row.Height = 100 ' Merge cells Set range = worksheet.Range_2("A1:D5") range.Merge() ' Write text Set cell = worksheet.Cell_2("A2") set leftCell = cell.MergedWithCell() leftCell.ValueAsHTML = "<center><b>Bold text</b> and <i>Italic text</i></center>" ' set alignment ' setting right alignment for the cell leftcell.AlignmentHorizontal = 3 ' see (0) Bytescout.Spreadsheet.Constants.AlignmentHorizontal.Right ' delete output file if exists already Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists("Output.xls")) Then fso.DeleteFile("Output.xls") Set fso = nothing ' save document document.SaveAs "Output.xls" ' close Spreadsheet Set document = Nothing