2 Replies Latest reply on Nov 5, 2013 10:15 AM by Jacob Cordingley

    How to adjust row height or column width in general table with API?

    Yong Ning

      Create general tables to use in drawings. These tables allow similar functionality to other SolidWorks tables

       

      0.jpg

      Help

      How to set table size→Set the number of Columns and Rows.

       

      SolidWorks Forums: API: Automating and customizing BOM tables (VBA)

      https://forum.solidworks.com/docs/DOC-1452

       

      SolidWorks Forums: Get Components in Each BOM Table Row (VBA) run-time error  SW2011 SP3

      https://forum.solidworks.com/message/222840#222840

        • Re: How to adjust row height or column width in general table with API?
          Simon Turner

          ITableAnnotiaton::

               - InsertRow

               - InsertColumn2

               - SetRowHeight

               - SetColumnWidth

          • Re: How to adjust row height or column width in general table with API?
            Jacob Cordingley

             

                    genTable = colorDrw.InsertTableAnnotation2(False, swView.GetOutline()(2), (swView.GetOutline()(1) + swView.GetOutline()(3)) / 2, 1, "", Trows, 2)

                    genTable.Anchored = False

                    tablefont = genTable.GetTextFormat

                    tableheaderfont = genTable.GetTextFormat

                    BOMfont = genTable.GetTextFormat

                    BOMfont.CharHeight = 0.0047244

                    tablefont.CharHeight = 0.0047752

                    tableheaderfont.CharHeight = 0.0047244

                    tableheaderfont.Bold = True

             

                    ' colorDrw.SetUserPreferenceTextFormat(swDetailingNoteTextFormat, BOMfont)

                    Dim j As Integer

                    iSwApp.SetUserPreferenceIntegerValue(swUserPreferenceIntegerValue_e.swBOMConfigurationAnchorType, swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_BottomRight)

                    swBOM = swView.InsertBomTable(bomtemp, 0.73, 0.08, longstatus)

                    swBOM.Detach()

             

                    genTable.SetTextFormat(False, tablefont)

                    genTable.SetCellTextFormat(j, 0, False, tableheaderfont)

                    genTable.SetCellTextFormat(j, 1, False, tableheaderfont)

            ' Fill Table

                    For j = 0 To Trows

             

             

                        genTable.Text(j, 0) = Color_table_info(j, 0)

                        genTable.Text(j, 1) = Color_table_info(j, 1)

                    Next j

            ' Set Row & Column Size

                    genTable.SetRowHeight(1, 0.05, swTableRowColSizeChangeBehavior_e.swTableRowColChange_AbsorbedByPrevious)

                    genTable.SetColumnWidth(0, 0.05, swTableRowColSizeChangeBehavior_e.swTableRowColChange_TableSizeCanChange)

                    genTable.SetColumnWidth(1, 0.05, swTableRowColSizeChangeBehavior_e.swTableRowColChange_TableSizeCanChange)

            ' Anchor Table

                    genTable.AnchorType = swconst.swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft