Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
ODF .NET
>
Tutorial
> Set column width
The following example shows you how to set column width.
C# example
using System; using Independentsoft.Office.Odf; using Independentsoft.Office.Odf.Styles; namespace Sample { class Program { static void Main(string[] args) { Spreadsheet spreadsheet = new Spreadsheet(); ColumnStyle columnStyle1 = new ColumnStyle("CO1"); columnStyle1.Width = new Size(3, Unit.Inch); spreadsheet.AutomaticStyles.Styles.Add(columnStyle1); Column column1 = new Column(); column1.Style = "CO1"; Table sheet1 = new Table(); sheet1.Columns.Add(column1); spreadsheet.Tables.Add(sheet1); spreadsheet.Save("c:\\test\\output.ods", true); } } }
VB example
Imports System Imports Independentsoft.Office.Odf Imports Independentsoft.Office.Odf.Styles Module Module1 Sub Main(ByVal args() As String) Dim spreadsheet As New Spreadsheet() Dim columnStyle1 As New ColumnStyle("CO1") columnStyle1.Width = New Size(3, Unit.Inch) spreadsheet.AutomaticStyles.Styles.Add(columnStyle1) Dim column1 As New Column() column1.Style = "CO1" Dim sheet1 As New Table() sheet1.Columns.Add(column1) spreadsheet.Tables.Add(sheet1) spreadsheet.Save("c:\test\output.ods", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*