예제 #1
0
        private void InsertBOMTable()
        {
            ModelDoc2 modelDoc2 = iswApp.ActiveDoc;

            ModelDocExtension modelDocExtension = modelDoc2.Extension;

            TableAnnotation tableAnnotation = modelDocExtension.InsertGeneralTableAnnotation(true, 0, 0, (int)swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft, @"E:\01_Work\14_Project\材料清单.sldtbt", bomItems.Count + 2, 7);

            for (int i = 0; i < bomItems.Count; i++)
            {
                tableAnnotation.Text[i + 2, 0] = (i + 1).ToString();
                tableAnnotation.Text[i + 2, 1] = bomItems[i].name;
                tableAnnotation.Text[i + 2, 2] = bomItems[i].material;
                tableAnnotation.Text[i + 2, 3] = bomItems[i].qty.ToString();
                tableAnnotation.Text[i + 2, 4] = bomItems[i].comment;
            }

            //tableAnnotation.SetColumnWidth(0, 10,0);

            //foreach (var b in bomItems)
            //{
            //	Debug.Print(b.code + "--->" + b.qty.ToString());

            //}
        }