public static void Run() { // ExStart:SetMilestoneProps // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Shapes(); // Load diagram Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx"); int shapeid = 22; // Get timeline shape Shape milestone = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); // Initialize MilestoneHelper object Aspose.Diagram.MilestoneHelper milestoneHelper = new MilestoneHelper(milestone); // Set milestone date milestoneHelper.MilestoneDate = new DateTime(2014, 10, 21); // Set date format milestoneHelper.DateFormat = 21; // Set auto update flag milestoneHelper.IsAutoUpdate = true; // Set milestone type milestoneHelper.Type = 6; // Save to VDX format diagram.Save(dataDir + "SetMilestoneProps_out.vsdx", SaveFileFormat.VSDX); // ExEnd:SetMilestoneProps }
public static void Run() { //ExStart:RefreshMilestoneWithMilestoneHelper // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Shapes(); string pageName = @"Page-1"; ////////////// Modify time line /////////// DateTime startDate = new DateTime(2015, 8, 1); DateTime endDate = new DateTime(2016, 6, 1); DateTime fisYear = startDate; //Load a diagram Diagram diagram = new Diagram(dataDir + "input.vdx"); //Get page Aspose.Diagram.Page page = diagram.Pages.GetPage(pageName); long timelineId = 1; Shape timeline = diagram.Pages.GetPage(pageName).Shapes.GetShape(timelineId); double xpos = timeline.XForm.PinX.Value; double ypos = timeline.XForm.PinY.Value; // Add milestone string milestoneMasterName = "2 triangle milestone"; //Add Master diagram.AddMaster(dataDir + "Timeline.vss", milestoneMasterName); //Add Shape in Visio diagram using AddShape method long milestoneShapeId = diagram.AddShape(xpos, ypos, milestoneMasterName, 0); //Get the shape based on ID Shape milestone = page.Shapes.GetShape(milestoneShapeId); //Instantiate MilestoneHelper object MilestoneHelper milestoneHelper = new MilestoneHelper(milestone); //Set Milestone Date milestoneHelper.MilestoneDate = new DateTime(2015, 8, 1); //Set IsAutoUpdate to true milestoneHelper.IsAutoUpdate = true; //RefreshMilesone of timeline shape milestoneHelper.RefreshMilestone(timeline); //Save Visio file diagram.Save(dataDir + "output.vdx", SaveFileFormat.VDX); //ExEnd:RefreshMilestoneWithMilestoneHelper }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Shapes(); string pageName = @"Page-1"; ////////////// Modify time line /////////// DateTime startDate = new DateTime(2015, 8, 1); DateTime endDate = new DateTime(2016, 6, 1); DateTime fisYear = startDate; //Load a diagram Diagram diagram = new Diagram(dataDir + "input.vdx"); //Get page Aspose.Diagram.Page page = diagram.Pages.GetPage(pageName); long timelineId = 1; Shape timeline = diagram.Pages.GetPage(pageName).Shapes.GetShape(timelineId); double xpos = timeline.XForm.PinX.Value; double ypos = timeline.XForm.PinY.Value; // Add milestone string milestoneMasterName = "2 triangle milestone"; //Add Master diagram.AddMaster(dataDir + "Timeline.vss", milestoneMasterName); //Add Shape in Visio diagram using AddShape method long milestoneShapeId = diagram.AddShape(xpos, ypos, milestoneMasterName, 0); //Get the shape based on ID Shape milestone = page.Shapes.GetShape(milestoneShapeId); //Instantiate MilestoneHelper object MilestoneHelper milestoneHelper = new MilestoneHelper(milestone); //Set Milestone Date milestoneHelper.MilestoneDate = new DateTime(2015, 8, 1); //Set IsAutoUpdate to true milestoneHelper.IsAutoUpdate = true; //RefreshMilesone of timeline shape milestoneHelper.RefreshMilestone(timeline); //Save Visio file diagram.Save(dataDir + "output.vdx", SaveFileFormat.VDX); }