Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am attempting to change the text justification in a table. In the API help I've fround the code below and I've been scouring the forms and no one seems to have a problem but when I'm running it I get "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
If I comment out the justifcation line it works just fine.
' a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument ' a reference to the active sheet. Dim oSheet As Sheet oSheet = oDrawDoc.ActiveSheet ' the column titles Dim oTitles(2) As String oTitles(0) = "Part Number" oTitles(1) = "Quantity" oTitles(2) = "Material" ' the contents of the custom table (contents are row-wise) Dim oContents(8) As String oContents(0) = "1" oContents(1) = "1" oContents(2) = "Brass" oContents(3) = "2" oContents(4) = "2" oContents(5) = "Aluminium" oContents(6) = "3" oContents(7) = "1" oContents(8) = "Steel" ' the column widths (defaults to the column title width if not specified) Dim oColumnWidths(2) As Double oColumnWidths(0) = 2.5 oColumnWidths(1) = 2.5 oColumnWidths(2) = 4 ' Create the custom table Dim oCustomTable As CustomTable oCustomTable = oSheet.CustomTables.Add("My Table", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 3, 3, oTitles, oContents, oColumnWidths) ' Change the 3rd column to be left justified. oCustomTable.Columns.Item(3).ValueHorizontalJustification = kAlignTextCenter ' Create a table format object Dim oFormat As TableFormat oFormat = oSheet.CustomTables.CreateTableFormat ' outside line weight. oFormat.InsideLineWeight = 0.025 oFormat.OutsideLineWeight = 0.025 ' Modify the table formats oCustomTable.OverrideFormat = oFormat
Solved! Go to Solution.