Quickly learn how to merge cells and set alignment with spreadsheet sdk in VBScript with this sample source code. ByteScout Data Extraction Suite: the bundle that includes three SDK tools for data extraction from PDF, scans, images and from spreadsheets: PDF Extractor SDK, Data Extraction SDK, Barcode Reader SDK. It can merge cells and set alignment with spreadsheet sdk in VBScript.
This prolific sample source code in VBScript for ByteScout Data Extraction Suite contains various functions and other necessary options you should do calling the API to merge cells and set alignment with spreadsheet sdk. Simply copy and paste in your VBScript project or application you and then run your app! Further improvement of the code will make it more robust.
You can download free trial version of ByteScout Data Extraction Suite from our website to see and try many others source code samples for VBScript.
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