手工移动是不可能的,总是有点误差,虽然有主动捕捉的功能。
public void SetTablePosition(TableAnnotation table, double x, double y) { table.Anchored = true; DrawingDoc swDrawing = (DrawingDoc)currentDoc; if (table.Anchored == true) { //Sheet sheet = v.Sheet; Sheet sheet = swDrawing.GetCurrentSheet() as Sheet; TableAnchor tableAnchor = sheet.get_TableAnchor((int)swTableAnnotationType_e.swTableAnnotation_General); //Determine type of table anchor table.AnchorType = (int)swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_BottomLeft; // Set the new position of the table anchor double[] dNewPosition = new double[2]; dNewPosition[0] = x; dNewPosition[1] = y; tableAnchor.Position = dNewPosition; } table.Anchored = false; }
一个sheet里面的一种表格只能有一个定位点。
所以当需要精确定位多个表格的时候,可以先表格先设置为附着点属性为true,定位完成后,设置为false。这样就不会相互干扰!