Represents a collection of ConductorTable objects.
Imports System.Runtime.InteropServices Module Module1 Sub Main() Dim objSEApplication As SolidEdgeFramework.Application Dim objDraftDoc As SolidEdgeDraft.DraftDocument Dim ConductorTable As SolidEdgeDraft.ConductorTable Dim ConductorTables As SolidEdgeDraft.ConductorTables Dim DrawingView As SolidEdgeDraft.DrawingView Dim StrFail As String Dim Titles As SolidEdgeDraft.TableTitles Dim Title As SolidEdgeDraft.TableTitle Dim Columns As SolidEdgeDraft.TableColumns Dim Column As SolidEdgeDraft.TableColumn Dim Rows As SolidEdgeDraft.TableRows Dim Row As SolidEdgeDraft.TableRow Dim Cell As SolidEdgeDraft.TableCell Dim Page As SolidEdgeDraft.TablePage Dim ListSavedSettings(2) As String Dim initialMarginH As Double Dim ii As Integer Dim strTableStyle As String Dim objAnchorPt As Object Dim intNumSavedSettings As Integer Dim arrList(10) As Object Try objSEApplication = Marshal.GetActiveObject("SolidEdge.Application") objDraftDoc = objSEApplication.ActiveDocument ConductorTables = objDraftDoc.ConductorTables DrawingView = objDraftDoc.ActiveSheet.DrawingViews.Item(1) 'Add ConductorTable = ConductorTables.Add(DrawingView) If ConductorTables.Count <> 1 Then StrFail = "Could not ADD ConductorTable." End If strTableStyle = ConductorTable.TableStyle objAnchorPt = ConductorTable.AnchorPoint ConductorTable.GetListOfSavedSettings(intNumSavedSettings, arrList) 'Update For Each ConductorTable In ConductorTables ConductorTable.Update() Next 'SavedSettings ConductorTable.SavedSettings = "Normal" If ConductorTables.Count <> 1 Then StrFail = "Could not UPDATE all ConductorTables." End If 'MarginHorizontal 'Taking initial margin for SavedSettings test below. initialMarginH = ConductorTable.MarginHorizontal ConductorTable.MarginHorizontal = initialMarginH * 2 If ConductorTable.MarginHorizontal <> initialMarginH * 2 Then StrFail = "Could not get or set MARGINHORIZONTAL." End If 'MarginVertical ConductorTable.MarginVertical = 0.01 If ConductorTable.MarginVertical <> 0.01 Then StrFail = "Could not get or set MARGINVERTICAL." End If ConductorTable.ColumnHeaderPosition = SolidEdgeDraft.TitlePosition.igHeader ConductorTable.ShowColumnHeader = False ConductorTable.MaximumRows = 100 ConductorTable.PageGap = 0.001 ConductorTable.ReverseDisplayOrder = True ConductorTable.HeaderFixedRowHeight = 0.007 ConductorTable.DataFixedRowHeight = 0.007 ConductorTable.NumberOfHeaderRows = 2 ConductorTable.MaximumRowsFirstPage = 100 ConductorTable.MaximumRowsAdditionalPages = 100 ConductorTable.MaximumHeightFirstPage = 0.3 ConductorTable.MaximumHeightAdditionalPages = 0.3 ConductorTable.CreateNewSheetsForTable = True ConductorTable.FirstSheetBackgroundName = "A1-Sheet" ConductorTable.AdditionalSheetsBackgroundName = "A1-Sheet" ConductorTable.ShowSheetBackground = True ConductorTable.MaintainSheetsWithTableSize = True ConductorTable.WrapDataCellsToNewRow = True ConductorTable.FillEndOfTableWithBlankRows = False ConductorTable.TitleFixedRowHeight = 0.01 ' titles Titles = ConductorTable.Titles Title = Titles.Add Title.value = "1st. title" Title.Position = SolidEdgeDraft.TitlePosition.igHeader Title.Alignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignRight Title.FitToWidth = True Title.FontName = "Arial" Title.FontStyle = SolidEdgeFrameworkSupport.DimTextFontStyleConstants.igDimStyleFontItalicBold Title.FontSize = 0.005 ' remove existing rows and columns Columns = ConductorTable.Columns Rows = ConductorTable.Rows ' columns Column = Columns.Add(1, False) Column.Width = 0.035 Column.DataHorizontalAlignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignRight Column.Show = True Column.SortPrecedence = 0 Column.SortAscending = True Column.DataMergeCellsWithSameValue = True Column.CurrentHeaderRow = 1 Column.HeaderRowValue = "Column 1" Column.HeaderRowHorizontalAlignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignCenter Column.HeaderRowVerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextVtAlignTop Column.HeaderRowOrientation = SolidEdgeDraft.TableTextOrientation.igHorizontal Column.HeaderRowFitToWidth = True Column.HeaderRowMergeWithNext = True Column.DataVerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextVtAlignTop Column.DataFitToWidth = True Column.CurrentHeaderRow = 2 Column.HeaderRowValue = "Secondary" Column = Columns.Add(2, False) Column.Header = "Column 2" Column.Width = 0.05 Column.SortPrecedence = 0 'rows For ii = Rows.Count To 4 Row = Rows.Add(ii, False) Next ' cell ConductorTable.Cell(1, 1).value = "a" ConductorTable.Cell(2, 1).value = "b" ConductorTable.Cell(3, 1).value = "c" ConductorTable.Cell(4, 1).value = "d" ConductorTable.Cell(1, 2).value = "1" ConductorTable.Cell(2, 2).value = "2" ConductorTable.Cell(3, 2).value = "3" ConductorTable.Cell(4, 2).value = "4" Cell = ConductorTable.Cell(1, 1) Cell.FontName = "Arial" Cell.FontStyle = SolidEdgeFrameworkSupport.DimTextFontStyleConstants.igDimStyleFontBold Cell.Underline = True Cell.HorizontalAlignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignCenter Cell.VerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextHzAlignVCenter 'update ConductorTable.Update() ConductorTable.SetOrigin(0.1, 0.1) 'Page Page = ConductorTable.Pages.Item(1) Page.SetOrigin(0.2, 0.2) Page.RotationAngle = 1.57 Page.Layer = "Default" ConductorTable = ConductorTables.Item(1) Catch ex As Exception Console.WriteLine(ex.ToString) End Try End Sub End Module
using System.Runtime.InteropServices; internal static class Module1 { public static void Main() { SolidEdgeFramework.Application objSEApplication = null; SolidEdgeDraft.DraftDocument objDraftDoc = null; SolidEdgeDraft.ConductorTable ConductorTable = null; SolidEdgeDraft.ConductorTables ConductorTables = null; SolidEdgeDraft.DrawingView DrawingView = null; string StrFail = null; SolidEdgeDraft.TableTitles Titles = null; SolidEdgeDraft.TableTitle Title = null; SolidEdgeDraft.TableColumns Columns = null; SolidEdgeDraft.TableColumn Column = null; SolidEdgeDraft.TableRows Rows = null; SolidEdgeDraft.TableRow Row = null; SolidEdgeDraft.TableCell Cell = null; SolidEdgeDraft.TablePage Page = null; string[] ListSavedSettings = new string[3]; double initialMarginH = 0; int ii = 0; string strTableStyle = null; object objAnchorPt = null; int intNumSavedSettings = 0; object[] arrList = new object[11]; try { objSEApplication = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application"); objDraftDoc = objSEApplication.ActiveDocument; ConductorTables = objDraftDoc.ConductorTables; DrawingView = objDraftDoc.ActiveSheet.DrawingViews.Item(1); //Add ConductorTable = ConductorTables.Add(DrawingView); if (ConductorTables.Count != 1) { StrFail = "Could not ADD ConductorTable."; } strTableStyle = ConductorTable.TableStyle; objAnchorPt = ConductorTable.AnchorPoint; ConductorTable.GetListOfSavedSettings(intNumSavedSettings, arrList); //Update foreach (SolidEdgeDraft.ConductorTable ConductorTableWithinLoop in ConductorTables) { ConductorTable = ConductorTableWithinLoop; ConductorTableWithinLoop.Update(); } //SavedSettings ConductorTable.SavedSettings = "Normal"; if (ConductorTables.Count != 1) { StrFail = "Could not UPDATE all ConductorTables."; } //MarginHorizontal //Taking initial margin for SavedSettings test below. initialMarginH = ConductorTable.MarginHorizontal; ConductorTable.MarginHorizontal = initialMarginH * 2; if (ConductorTable.MarginHorizontal != initialMarginH * 2) { StrFail = "Could not get or set MARGINHORIZONTAL."; } //MarginVertical ConductorTable.MarginVertical = 0.01; if (ConductorTable.MarginVertical != 0.01) { StrFail = "Could not get or set MARGINVERTICAL."; } ConductorTable.ColumnHeaderPosition = SolidEdgeDraft.TitlePosition.igHeader; ConductorTable.ShowColumnHeader = false; ConductorTable.MaximumRows = 100; ConductorTable.PageGap = 0.001; ConductorTable.ReverseDisplayOrder = true; ConductorTable.HeaderFixedRowHeight = 0.007; ConductorTable.DataFixedRowHeight = 0.007; ConductorTable.NumberOfHeaderRows = 2; ConductorTable.MaximumRowsFirstPage = 100; ConductorTable.MaximumRowsAdditionalPages = 100; ConductorTable.MaximumHeightFirstPage = 0.3; ConductorTable.MaximumHeightAdditionalPages = 0.3; ConductorTable.CreateNewSheetsForTable = true; ConductorTable.FirstSheetBackgroundName = "A1-Sheet"; ConductorTable.AdditionalSheetsBackgroundName = "A1-Sheet"; ConductorTable.ShowSheetBackground = true; ConductorTable.MaintainSheetsWithTableSize = true; ConductorTable.WrapDataCellsToNewRow = true; ConductorTable.FillEndOfTableWithBlankRows = false; ConductorTable.TitleFixedRowHeight = 0.01; // titles Titles = ConductorTable.Titles; Title = Titles.Add; Title.value = "1st. title"; Title.Position = SolidEdgeDraft.TitlePosition.igHeader; Title.Alignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignRight; Title.FitToWidth = true; Title.FontName = "Arial"; Title.FontStyle = SolidEdgeFrameworkSupport.DimTextFontStyleConstants.igDimStyleFontItalicBold; Title.FontSize = 0.005; // remove existing rows and columns Columns = ConductorTable.Columns; Rows = ConductorTable.Rows; // columns Column = Columns.Add(1, false); Column.Width = 0.035; Column.DataHorizontalAlignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignRight; Column.Show = true; Column.SortPrecedence = 0; Column.SortAscending = true; Column.DataMergeCellsWithSameValue = true; Column.CurrentHeaderRow = 1; Column.HeaderRowValue = "Column 1"; Column.HeaderRowHorizontalAlignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignCenter; Column.HeaderRowVerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextVtAlignTop; Column.HeaderRowOrientation = SolidEdgeDraft.TableTextOrientation.igHorizontal; Column.HeaderRowFitToWidth = true; Column.HeaderRowMergeWithNext = true; Column.DataVerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextVtAlignTop; Column.DataFitToWidth = true; Column.CurrentHeaderRow = 2; Column.HeaderRowValue = "Secondary"; Column = Columns.Add(2, false); Column.Header = "Column 2"; Column.Width = 0.05; Column.SortPrecedence = 0; //rows for (ii = Rows.Count; ii <= 4; ii++) { Row = Rows.Add(ii, false); } // cell ConductorTable.Cell(1, 1).value = "a"; ConductorTable.Cell(2, 1).value = "b"; ConductorTable.Cell(3, 1).value = "c"; ConductorTable.Cell(4, 1).value = "d"; ConductorTable.Cell(1, 2).value = "1"; ConductorTable.Cell(2, 2).value = "2"; ConductorTable.Cell(3, 2).value = "3"; ConductorTable.Cell(4, 2).value = "4"; Cell = ConductorTable.Cell(1, 1); Cell.FontName = "Arial"; Cell.FontStyle = SolidEdgeFrameworkSupport.DimTextFontStyleConstants.igDimStyleFontBold; Cell.Underline = true; Cell.HorizontalAlignment = SolidEdgeFrameworkSupport.TextHorizontalAlignmentConstants.igTextHzAlignCenter; Cell.VerticalAlignment = SolidEdgeFrameworkSupport.TextVerticalAlignmentConstants.igTextHzAlignVCenter; //update ConductorTable.Update(); ConductorTable.SetOrigin(0.1, 0.1); //Page Page = ConductorTable.Pages.Item(1); Page.SetOrigin(0.2, 0.2); Page.RotationAngle = 1.57; Page.Layer = "Default"; ConductorTable = ConductorTables.Item(1); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } }