Hi,
I want to create a custom style for a table and add it to a word document. But it throws error like “Cannot create table styles”. My code is
Dim builder1 As DocumentBuilder = New DocumentBuilder(wordDocument)
Dim style As Aspose.Words.Tables.Table = Nothing
style.Style = wordDocument.Styles.Add(StyleType.Table, "WKF_TableLetter_Style")
With style.Rows(0).RowFormat
.Borders.Top.LineStyle = Aspose.Words.LineStyle.Single
.Borders.Vertical.LineStyle = Aspose.Words.LineStyle.Single
.Borders.Horizontal.LineStyle = Aspose.Words.LineStyle.Single
.Borders.Bottom.LineStyle = Aspose.Words.LineStyle.Single
.Borders.Left.LineStyle = Aspose.Words.LineStyle.Single
.Borders.Right.LineStyle = Aspose.Words.LineStyle.Single
.AllowBreakAcrossPages = True
End With
But same works fine for the paragraph. Below code works fine for paragraph.
Dim doc As Document = New Document()
Dim builder1 As DocumentBuilder = New DocumentBuilder(wordDocument)
Dim style As Aspose.Words.Style = wordDocument.Styles.Add(StyleType.Paragraph, "WKF_TableLetter_Style")
style.IsQuickStyle = True
style.Font.Size = 24
style.Font.SizeBi = 24
style.Font.Name = "B Mitra"
style.Font.NameBi = "B Mitra"
builder1.ParagraphFormat.Style = style
Please kindly help me on this.
Regards,
Raj