Problem setting cell width in dynamically created table

I am trying to build a table dynamically within a document but am not able to set the width of the newly created cell. I’m using CellFormat.Width but it does not seem to work - instead the cell is much wider. CellFormat.Width seems to have no affect. Following is the core code I am calling:

Dim doc As New Document
doc = New Document(Reports.CommonReport.GetFullTemplateDocumentName("BODY.doc"))
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
With builder
.MoveToMergeField("ExecDiv")
.Writeln("Hello World")
.StartTable()
.RowFormat.Height = 10
.RowFormat.HeightRule = HeightRule.Auto
.RowFormat.AllowAutoFit = False
.InsertCell()
.CellFormat.ClearFormatting()
'-----------------------------------
' The statement below does not seem to affect column width
'-----------------------------------
.CellFormat.Width = 100
.Write("Hi")
.EndRow()
.EndTable()
End With
doc.Save("Test.doc")
BuildTable = True

I am attaching the above code and Word template (BODY.DOC) referenced above.
Thanks

Hi
Thanks for your inquiry. I managed to reproduce the problem. I have logged this problem to our defect database as issue # 4196. Please expect a reply before the next hotfix (within 2-3 weeks). Also you can use the following code to solve this problem.

Dim doc As New Document
doc = New Document("BODY.doc")
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
Dim newTable As Table = New Table(doc)
Dim newRow As Row = New Row(doc)
Dim newCell As Cell = New Cell(doc)
Dim newPar As Paragraph = New Paragraph(doc)
Dim newRun As Run = New Run(doc)
newPar.AppendChild(newRun)
newCell.AppendChild(newPar)
newRow.AppendChild(newCell)
newTable.AppendChild(newRow)
newRow.RowFormat.HeightRule = HeightRule.AtLeast
newRow.RowFormat.Height = 14
newCell.CellFormat.Width = 100
newRun.Text = "Hi"
builder.MoveToMergeField("ExecDiv")
builder.Writeln("Hello World")
builder.CurrentParagraph.ParentNode.InsertAfter(newTable, builder.CurrentParagraph)
doc.Save("Test.doc")

I hope that this will help you.
Best regards.

Thanks Alexey, this solution solves my problem.

The issues you have found earlier (filed as WORDSNET-1477) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.