Database db = adoc.Database;
int intTableHeight = 173;
int intPosColumnInModel = 1;
int intPosRowInModel = 8;
int intCurRowSpecaSheet = 0;
bool bNewSheetSpeca = true;
Table tbl = new Table();
tbl.TableStyle = db.Tablestyle;
double RowHeight = 7.0;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
for (int n = 0; n < Speca.Count; n++)
{
if (bNewSheetSpeca)
{
tbl = new Table();
tbl.TableStyle = db.Tablestyle;
tbl.SetColumnWidth(40.0);
tbl.SetRowHeight(RowHeight);
tbl.InsertColumns(0, 20.0, 1);
tbl.InsertColumns(1, 130.0, 1);
tbl.InsertColumns(2, 60.0, 1);
tbl.InsertColumns(3, 35.0, 1);
tbl.InsertColumns(4, 45.0, 1);
tbl.InsertColumns(5, 20.0, 2);
tbl.InsertColumns(7, 25.0, 1);
BlockReference blRef = DrawBlock(intShagSetkiX * (intPosColumnInModel - 1), -intShagSetkiY * (intPosRowInModel - 1), ".Рамка А3 спека");
DrawAttribute(blRef, false, 387.5, 25.0, "NUM_SHEET", "1", AttachmentPoint.MiddleCenter);
DrawAttribute(blRef, false, 387.5, 25.0, "NUM_SHEET1", "2", AttachmentPoint.MiddleCenter);
DrawAttribute(blRef, false, 330.0, 12.5, "NAME_SHEET", "Спецификация оборудования, изделий и материалов", AttachmentPoint.MiddleCenter);
DrawBlock(intShagSetkiX * (intPosColumnInModel - 1) + 20.0, -intShagSetkiY * (intPosRowInModel - 1) + 292.0, ".шапка спека");
tbl.Position = new Point3d(intShagSetkiX * (intPosColumnInModel - 1) + 20, -intShagSetkiY * (intPosRowInModel - 1) + 249.0, 0.0);
tbl.GenerateLayout();
BlockTableRecord sp = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
sp.AppendEntity(tbl);
tr.AddNewlyCreatedDBObject(tbl, true);
bNewSheetSpeca = false;
intCurRowSpecaSheet = 0;
}
for (int m = 0; m < tbl.Columns.Count; m++)
{
tbl.Cells[intCurRowSpecaSheet, 1].TextString = "\\W0.75;" + Speca[n]?.strName ?? "";
tbl.Cells[intCurRowSpecaSheet, 2].TextString = "\\W0.75;" + Speca[n]?.strMarka ?? "";
tbl.Cells[intCurRowSpecaSheet, 4].TextString = "\\W0.75;" + Speca[n]?.strIzgotovitel ?? "";
tbl.Cells[intCurRowSpecaSheet, 5].TextString = "\\W0.75;" + Speca[n]?.strEdIzm ?? "";
tbl.Cells[intCurRowSpecaSheet, 6].TextString = "\\W0.75;" + Speca[n]?.strKolvo ?? "";
tbl.Cells[intCurRowSpecaSheet, m].Borders.Right.LineWeight = LineWeight.LineWeight060;
tbl.Cells[intCurRowSpecaSheet, m].Borders.Left.LineWeight = LineWeight.LineWeight060;
if (m == 1)
{
tbl.Cells[intCurRowSpecaSheet, m].Alignment = CellAlignment.MiddleLeft;
tbl.SetMargin(intCurRowSpecaSheet, m, CellMargins.Left, 3);
}
}
tbl.GenerateLayout();
if (tbl.Height > intTableHeight)
{
tbl.DeleteRows(intCurRowSpecaSheet, 1);
n--;
bNewSheetSpeca = true;
intPosColumnInModel++;
tbl.RecomputeTableBlock(true);
}
else
tbl.InsertRows(intCurRowSpecaSheet++, RowHeight, 1);
}
tr.Commit();
}