Ilogic rule generated table - alter colunm widths so that the text wraps?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following code: Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument Dim oSheet As Sheet = oDrawDoc.ActiveSheet ExcelFile = "D:\Inventor - GA\TankBuilder.xlsx" ' Set the column titles Dim oTitles(9) As String oTitles(0) = "REF." oTitles(1) = "DUTY / DESCRIPTION" oTitles(2) = "MATERIAL / FINISH:" oTitles(3) = "FLANGE RATING:" oTitles(4) = "SINGE / DOUBLE:" oTitles(5) = "OFFSTANDS (EXT. / INT.):" oTitles(6) = "ELEVATION (TO):" oTitles(7) = "ANGLE (TO):" oTitles(8) = "ADPT. BRKT. (INT. / EXT.)" oTitles(9) = "BLANK FLANGE TYPE:" numberOfConnections = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "L1") Dim oColumnWidths(9) As Double oColumnWidths(0) = 1 For i = 1 To 9 oColumnWidths(i) = 1 Next tableValue = numberOfConnections * 9 + (numberOfConnections-1) rowNumber = 3 ' Set the contents of the custom table (contents are set row-wise) Dim oContents(tableValue) As String content = 0 For contentCounter = 1 To numberOfConnections oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "A" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "B" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "D" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "E" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "F" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "G" & rowNumber) & " " & GoExcel.CellValue(ExcelFile, "CONNECTIONS", "H" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "I" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "J" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "K" & rowNumber) content = content + 1 oContents(content) = GoExcel.CellValue(ExcelFile, "CONNECTIONS", "L" & rowNumber) content = content + 1 Next oPlacementPoint = ThisApplication.TransientGeometry.CreatePoint2d(3, 40) ' Create the custom table Dim oCustomTable As CustomTable oCustomTable = oSheet.CustomTables.Add("My Table", oPlacementPoint, _ 10, numberOfConnections, oTitles, oContents, oColumnWidths) For count = 1 To 10 oCustomTable.Columns.Item(count).ValueHorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextCenter Next oCustomTable.ShowTitle = False ' Create a table format object Dim oFormat As TableFormat oFormat = oSheet.CustomTables.CreateTableFormat oFormat.OutsideLineWeight = 0.01 oFormat.InsideLineWeight = 0.01 ' Modify the table formats oCustomTable.OverrideFormat = oFormat This code generates the attached image. As you can see the column headings are generated to be the width of the text and this doesn't seem to change to any smaller no matter how much I change the oColumnWidths. This bit of the code: Dim oColumnWidths(9) As Double oColumnWidths(0) = 1 For i = 1 To 9 oColumnWidths(i) = 1 Next Is there anyway to get the text to wrap? So it goes onto multiple lines without having to go in and manually change this with dragging the lines of the table? Much thanks