/// <summary> /// Remove all tab stops on the shape /// </summary> /// <param name="shape"></param> private static void ClearTabStops(IVisio.Shape shape) { if (shape == null) { throw new System.ArgumentNullException(nameof(shape)); } int num_existing_tabstops = TextFormat.GetTabStopCount(shape); if (num_existing_tabstops < 1) { return; } var cell_tabstopcount = shape.CellsSRC[TextFormat.src_tabstopcount.Section, TextFormat.src_tabstopcount.Row, TextFormat.src_tabstopcount.Cell]; cell_tabstopcount.FormulaForce = "0"; const string formula = "0"; var update = new ShapeSheet.Update(); for (int i = 1; i < num_existing_tabstops * 3; i++) { var src = new ShapeSheet.SRC(TextFormat.tab_section, (short)IVisio.VisRowIndices.visRowTab, (short)i); update.SetFormula(src, formula); } update.Execute(shape); }
private static IList <TabStop> GetTabStops(IVisio.Shape shape) { if (shape == null) { throw new System.ArgumentNullException(nameof(shape)); } int num_stops = TextFormat.GetTabStopCount(shape); if (num_stops < 1) { return(new List <TabStop>(0)); } const short row = 0; var srcs = new List <ShapeSheet.SRC>(num_stops * 3); for (int stop_index = 0; stop_index < num_stops; stop_index++) { int i = stop_index * 3; var src_tabpos = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 1)); var src_tabalign = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 2)); var src_tabother = new ShapeSheet.SRC(TextFormat.tab_section, row, (short)(i + 3)); srcs.Add(src_tabpos); srcs.Add(src_tabalign); srcs.Add(src_tabother); } var surface = new ShapeSheet.ShapeSheetSurface(shape); var stream = ShapeSheet.SRC.ToStream(srcs); var unitcodes = srcs.Select(i => IVisio.VisUnitCodes.visNumber).ToList(); var results = surface.GetResults_SRC <double>(stream, unitcodes); var stops_list = new List <TabStop>(num_stops); for (int stop_index = 0; stop_index < num_stops; stop_index++) { var pos = results[(stop_index * 3) + 1]; var align = (TabStopAlignment)((int)results[(stop_index * 3) + 2]); var ts = new TabStop(pos, align); stops_list.Add(ts); } return(stops_list); }