public static void Run() { // ExStart:AddGroupShapeToDocument // The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithDocument(); Document doc = new Document(); doc.EnsureMinimum(); GroupShape gs = new GroupShape(doc); Shape shape = new Shape(doc, Drawing.ShapeType.AccentBorderCallout1); shape.Width = 100; shape.Height = 100; gs.AppendChild(shape); Shape shape1 = new Shape(doc, Drawing.ShapeType.ActionButtonBeginning); shape1.Left = 100; shape1.Width = 100; shape1.Height = 200; gs.AppendChild(shape1); gs.Width = 200; gs.Height = 200; gs.CoordSize = new System.Drawing.Size(200, 200); DocumentBuilder builder = new DocumentBuilder(doc); builder.InsertNode(gs); dataDir = dataDir + "groupshape-doc_out.doc"; // Save the document to disk. doc.Save(dataDir); // ExEnd:AddGroupShapeToDocument Console.WriteLine("\nGroup shape added successfully.\nFile saved at " + dataDir); }
/// <summary> /// Perform redo of this command. /// </summary> public override void Redo() { //create a new group; use the standard GroupShape or the CollapsibleGroupShape for a painted group with collapse/expand features. //GroupShape group = new GroupShape(this.Controller.Model); //CollapsibleGroupShape group = new CollapsibleGroupShape(this.controller.Model); GroupShape group = new GroupShape(this.controller.Model); //asign the entities to the group group.Entities.Clear(); foreach (IDiagramEntity entity in bundle.Entities) { //this will be recursive if an entity is itself an IGroup entity.Group = group; group.Entities.Add(entity); } //add the new group to the layer this.Controller.Model.AddEntity(group); mGroup = group; //select the newly created group CollectionBase<IDiagramEntity> col = new CollectionBase<IDiagramEntity>(); col.Add(mGroup); this.Controller.Model.Selection.SelectedItems = col; mGroup.Invalidate(); }
/// <summary> /// Perform undo of this command. /// </summary> public override void Undo() { //create a new group GroupShape group = new GroupShape(this.Controller.Model); //asign the entities to the group group.Entities = bundle.Entities; foreach (IDiagramEntity entity in group.Entities) { //this will be recursive if an entity is itself an IGroup entity.Group = group; } //add the new group to the layer this.Controller.Model.DefaultPage.DefaultLayer.Entities.Add(group); mGroup = group; //select the newly created group CollectionBase<IDiagramEntity> col = new CollectionBase<IDiagramEntity>(); col.Add(mGroup); this.Controller.Model.Selection.SelectedItems = col; mGroup.Invalidate(); }
/// <summary> /// Create a child shape with its specified properties and add into specified group shape /// </summary> /// <param name="autoShapeType">Represent the AutoShapeType of child shape</param> /// <param name="bounds">Represent the bounds of child shape to be placed</param> /// <param name="rotation">Represent the rotation of child shape</param> /// <param name="flipH">Represent the horizontal flip of child shape</param> /// <param name="flipV">Represent the vertical flip of child shape</param> /// <param name="fillColor">Represent the fill color of child shape</param> /// <param name="text">Represent the text that to be append in child shape</param> /// <param name="groupShape">Represent the group shape to add a child shape</param> /// <param name="wordDocument">Represent the Word document instance</param> private static void CreateChildShape(AutoShapeType autoShapeType, RectangleF bounds, float rotation, bool flipH, bool flipV, Syncfusion.Drawing.Color fillColor, string text, GroupShape groupShape, WordDocument wordDocument) { //Creates new shape to add into group Shape shape = new Shape(wordDocument, autoShapeType); //Sets height and width for shape shape.Height = bounds.Height; shape.Width = bounds.Width; //Sets horizontal and vertical position shape.HorizontalPosition = bounds.X; shape.VerticalPosition = bounds.Y; //Set rotation and flipH for the shape if (rotation != 0) { shape.Rotation = rotation; } if (flipH) { shape.FlipHorizontal = true; } if (flipV) { shape.FlipVertical = true; } //Applies fill color for shape if (fillColor != Syncfusion.Drawing.Color.White) { shape.FillFormat.Fill = true; shape.FillFormat.Color = fillColor; } //Set wrapping style for shape shape.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText; //Sets horizontal and vertical origin shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; //Sets no line to RoundedRectangle shapes if (autoShapeType == AutoShapeType.RoundedRectangle) { shape.LineFormat.Line = false; } //Add paragraph for the shape textbody if (text != null) { IWParagraph paragraph = shape.TextBody.AddParagraph(); //Set required textbody alignments shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle; //Set required paragraph alignments paragraph.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; IWTextRange textRange = paragraph.AppendText(text); //Applies a required text formatting's textRange.CharacterFormat.FontName = "Calibri"; textRange.CharacterFormat.FontSize = 15; textRange.CharacterFormat.TextColor = Syncfusion.Drawing.Color.White; textRange.CharacterFormat.Bold = true; textRange.CharacterFormat.Italic = true; } //Adds the specified shape to group shape groupShape.Add(shape); }
void OnConvertClicked(object sender, EventArgs e) { //Creates a new Word document WordDocument document = new WordDocument(); //Adds new section to the document IWSection section = document.AddSection(); //Sets page setup options section.PageSetup.Orientation = PageOrientation.Landscape; section.PageSetup.Margins.All = 72; section.PageSetup.PageSize = new SizeF(792f, 612f); //Adds new paragraph to the section WParagraph paragraph = section.AddParagraph() as WParagraph; //Creates new group shape GroupShape groupShape = new GroupShape(document); //Adds group shape to the paragraph. paragraph.ChildEntities.Add(groupShape); //Create a RoundedRectangle shape with "Management" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(324f, 107.7f, 144f, 45f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(50, 48, 142), "Management", groupShape, document); //Create a BentUpArrow shape to connect with "Development" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(177.75f, 176.25f, 210f, 50f), 180, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Sales" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(403.5f, 175.5f, 210f, 50f), 180, true, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Production" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(381f, 153f, 29.25f, 72.5f), 0, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Development" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(135f, 226.45f, 110f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(104, 57, 157), "Development", groupShape, document); //Create a RoundedRectangle shape with "Production" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(341f, 226.5f, 110f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(149, 50, 118), "Production", groupShape, document); //Create a RoundedRectangle shape with "Sales" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(546.75f, 226.5f, 110f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(179, 63, 62), "Sales", groupShape, document); //Create a DownArrow shape to connect with "Software" and "Hardware" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(177f, 265.5f, 25.5f, 20.25f), 0, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Series" and "Parts" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(383.25f, 265.5f, 25.5f, 20.25f), 0, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "North" and "South" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(588.75f, 266.25f, 25.5f, 20.25f), 0, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Software" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(129.5f, 286.5f, 60f, 33f), 180, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Hardware" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(190.5f, 286.5f, 60f, 33f), 180, true, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Series" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(336f, 287.25f, 60f, 33f), 180, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Parts" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(397f, 287.25f, 60f, 33f), 180, true, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "North" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(541.5f, 288f, 60f, 33f), 180, false, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "South" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(602.5f, 288f, 60f, 33f), 180, true, false, Syncfusion.Drawing.Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Software" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(93f, 320.25f, 90f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(23, 187, 189), "Software", groupShape, document); //Create a RoundedRectangle shape with "Hardware" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(197.2f, 320.25f, 90f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(24, 159, 106), "Hardware", groupShape, document); //Create a RoundedRectangle shape with "Series" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(299.25f, 320.25f, 90f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(23, 187, 189), "Series", groupShape, document); //Create a RoundedRectangle shape with "Parts" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(404.2f, 320.25f, 90f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(24, 159, 106), "Parts", groupShape, document); //Create a RoundedRectangle shape with "North" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(505.5f, 321.75f, 90f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(23, 187, 189), "North", groupShape, document); //Create a RoundedRectangle shape with "South" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(609.7f, 321.75f, 90f, 40f), 0, false, false, Syncfusion.Drawing.Color.FromArgb(24, 159, 106), "South", groupShape, document); string fileName = null; string ContentType = null; MemoryStream ms = new MemoryStream(); if (pdfButton != null && (bool)pdfButton.IsChecked) { fileName = "GroupShapes.pdf"; ContentType = "application/pdf"; DocIORenderer renderer = new DocIORenderer(); PdfDocument pdfDoc = renderer.ConvertToPDF(document); pdfDoc.Save(ms); pdfDoc.Close(); } else { fileName = "GroupShapes.docx"; ContentType = "application/msword"; document.Save(ms, FormatType.Docx); } //Reset the stream position ms.Position = 0; //Close the document instance. document.Close(); if (ms != null) { SaveiOS iOSSave = new SaveiOS(); iOSSave.Save(fileName, ContentType, ms as MemoryStream); } }
public override VisitorAction VisitGroupShapeEnd(GroupShape groupShape) { mBuilder.AppendLine("End of shape group"); return(VisitorAction.Continue); }
public override VisitorAction VisitGroupShapeStart(GroupShape groupShape) { mBuilder.AppendLine("Shape group started:"); return(VisitorAction.Continue); }
void OnButtonClicked(object sender, EventArgs e) { //Initialize Word document WordDocument doc = new WordDocument(); //Ensure Minimum doc.EnsureMinimal(); //Set margins for page. doc.LastSection.PageSetup.Margins.All = 72; //Create new group shape GroupShape groupShape = new GroupShape(doc); //Append AutoShape Shape shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; //Set horizontal origin shape.HorizontalOrigin = HorizontalOrigin.Page; //Set vertical origin shape.VerticalOrigin = VerticalOrigin.Page; //Set vertical position shape.VerticalPosition = 122; //Set horizontal position shape.HorizontalPosition = 220; //Set AllowOverlap to true for overlapping shapes shape.WrapFormat.AllowOverlap = true; //Set Fill Color shape.FillFormat.Color = Syncfusion.Drawing.Color.Blue; //Set Content vertical alignment shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle; //Add Texbody contents to Shape IWParagraph para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Requirement").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Syncfusion.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 167; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 212; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = Syncfusion.Drawing.Color.Orange; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Design").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Syncfusion.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 257; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 302; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = Syncfusion.Drawing.Color.Blue; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Execution").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Syncfusion.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 347; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 392; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = Syncfusion.Drawing.Color.Violet; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Testing").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Syncfusion.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 437; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 482; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = Syncfusion.Drawing.Color.PaleVioletRed; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Release").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = Syncfusion.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); doc.LastParagraph.ChildEntities.Add(groupShape); string filename = ""; string contenttype = ""; MemoryStream outputStream = new MemoryStream(); if (this.pdfButton.IsChecked != null && (bool)this.pdfButton.IsChecked) { filename = "GroupShapes.pdf"; contenttype = "application/pdf"; DocIORenderer renderer = new DocIORenderer(); PdfDocument pdfDoc = renderer.ConvertToPDF(doc); pdfDoc.Save(outputStream); pdfDoc.Close(); } else { filename = "GroupShapes.docx"; contenttype = "application/msword"; doc.Save(outputStream, FormatType.Docx); } doc.Close(); if (Device.RuntimePlatform == Device.UWP) { DependencyService.Get <ISaveWindowsPhone>() .Save(filename, contenttype, outputStream); } else { DependencyService.Get <ISave>().Save(filename, contenttype, outputStream); } }
/// <summary> /// Remove group. /// </summary> /// <param name="project">The project instance.</param> /// <param name="group">The group instance.</param> /// <returns>The owner group library.</returns> public static Library <GroupShape> RemoveGroup(this ProjectContainer project, GroupShape group) { if (project?.GroupLibraries != null && group != null) { var library = project.GroupLibraries.FirstOrDefault(l => l.Items.Contains(group)); if (library?.Items != null) { var previous = library.Items; var next = library.Items.Remove(group); project?.History?.Snapshot(previous, next, (p) => library.Items = p); library.Items = next; } return(library); } return(null); }
/// <summary> /// Add group. /// </summary> /// <param name="project">The project instance.</param> /// <param name="library">The group library instance.</param> /// <param name="group">The group instance.</param> public static void AddGroup(this ProjectContainer project, Library <GroupShape> library, GroupShape group) { AddItem(project, library, group); }
internal static void AddFigure(IToolContext context, GroupShape group, double dx, double dy, SKPath geometry) { AddFigure(context, group.Shapes, false, dx, dy, geometry); }
public ActionResult GroupShapes(string Group1) { if (Group1 == null) { return(View()); } //Creates a new Word document WordDocument document = new WordDocument(); //Adds new section to the document IWSection section = document.AddSection(); //Sets page setup options section.PageSetup.Orientation = PageOrientation.Landscape; section.PageSetup.Margins.All = 72; section.PageSetup.PageSize = new SizeF(792f, 612f); //Adds new paragraph to the section WParagraph paragraph = section.AddParagraph() as WParagraph; //Creates new group shape GroupShape groupShape = new GroupShape(document); //Adds group shape to the paragraph. paragraph.ChildEntities.Add(groupShape); //Create a RoundedRectangle shape with "Management" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(324f, 107.7f, 144f, 45f), 0, false, false, Color.FromArgb(50, 48, 142), "Management", groupShape, document); //Create a BentUpArrow shape to connect with "Development" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(177.75f, 176.25f, 210f, 50f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Sales" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(403.5f, 175.5f, 210f, 50f), 180, true, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Production" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(381f, 153f, 29.25f, 72.5f), 0, false, false, Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Development" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(135f, 226.45f, 110f, 40f), 0, false, false, Color.FromArgb(104, 57, 157), "Development", groupShape, document); //Create a RoundedRectangle shape with "Production" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(341f, 226.5f, 110f, 40f), 0, false, false, Color.FromArgb(149, 50, 118), "Production", groupShape, document); //Create a RoundedRectangle shape with "Sales" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(546.75f, 226.5f, 110f, 40f), 0, false, false, Color.FromArgb(179, 63, 62), "Sales", groupShape, document); //Create a DownArrow shape to connect with "Software" and "Hardware" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(177f, 265.5f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Series" and "Parts" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(383.25f, 265.5f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "North" and "South" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(588.75f, 266.25f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Software" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(129.5f, 286.5f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Hardware" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(190.5f, 286.5f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Series" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(336f, 287.25f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Parts" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(397f, 287.25f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "North" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(541.5f, 288f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "South" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(602.5f, 288f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Software" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(93f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "Software", groupShape, document); //Create a RoundedRectangle shape with "Hardware" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(197.2f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "Hardware", groupShape, document); //Create a RoundedRectangle shape with "Series" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(299.25f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "Series", groupShape, document); //Create a RoundedRectangle shape with "Parts" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(404.2f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "Parts", groupShape, document); //Create a RoundedRectangle shape with "North" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(505.5f, 321.75f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "North", groupShape, document); //Create a RoundedRectangle shape with "South" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(609.7f, 321.75f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "South", groupShape, document); string filename = ""; string contenttype = ""; MemoryStream ms = new MemoryStream(); #region Document SaveOption //Save as .docx format if (Group1 == "WordDocx") { filename = "Sample.docx"; contenttype = "application/vnd.ms-word.document.12"; document.Save(ms, FormatType.Docx); } //Save as .xml format else if (Group1 == "WordML") { filename = "Sample.xml"; contenttype = "application/msword"; document.Save(ms, FormatType.WordML); } //Save as .pdf format else if (Group1 == "Pdf") { filename = "Sample.pdf"; contenttype = "application/pdf"; DocIORenderer renderer = new DocIORenderer(); PdfDocument pdfDoc = renderer.ConvertToPDF(document); pdfDoc.Save(ms); pdfDoc.Close(); } #endregion Document SaveOption document.Close(); ms.Position = 0; return(File(ms, contenttype, filename)); }
/// <summary> /// Initializes static designer context. /// </summary> /// <param name="serviceProvider">The service provider.</param> public static void InitializeContext(IServiceProvider serviceProvider) { // Editor Editor = serviceProvider.GetService <ProjectEditor>(); // Recent Projects Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test1", "Test1.project")); Editor.RecentProjects = Editor.RecentProjects.Add(RecentFile.Create("Test2", "Test2.project")); // New Project Editor.OnNewProject(); // Transform Transform = MatrixObject.Identity; // Data var db = Database.Create("Db"); var fields = new string[] { "Column0", "Column1" }; var columns = ImmutableArray.CreateRange(fields.Select(c => Column.Create(db, c))); db.Columns = columns; var values = Enumerable.Repeat("<empty>", db.Columns.Length).Select(c => Value.Create(c)); var record = Record.Create( db, ImmutableArray.CreateRange(values)); db.Records = db.Records.Add(record); db.CurrentRecord = record; Database = db; Data = Context.Create(record); Record = record; // Project IProjectFactory factory = new ProjectFactory(); Project = factory.GetProject(); Template = PageContainer.CreateTemplate(); Page = PageContainer.CreatePage(); var layer = Page.Layers.FirstOrDefault(); layer.Shapes = layer.Shapes.Add(LineShape.Create(0, 0, null, null)); Page.CurrentLayer = layer; Page.CurrentShape = layer.Shapes.FirstOrDefault(); Page.Template = Template; Document = DocumentContainer.Create(); Layer = LayerContainer.Create(); Options = Options.Create(); CurrentStyleLibrary = Project.CurrentStyleLibrary; CurrentGroupLibrary = Project.CurrentGroupLibrary; // State State = ShapeState.Create(); // Style ArgbColor = ArgbColor.Create(128, 255, 0, 0); ArrowStyle = ArrowStyle.Create(); FontStyle = FontStyle.Create(); LineFixedLength = LineFixedLength.Create(); LineStyle = LineStyle.Create(); Style = ShapeStyle.Create("Default"); TextStyle = TextStyle.Create(); // Shapes Arc = ArcShape.Create(0, 0, Style, null); CubicBezier = CubicBezierShape.Create(0, 0, Style, null); Ellipse = EllipseShape.Create(0, 0, Style, null); Group = GroupShape.Create(Constants.DefaulGroupName); Image = ImageShape.Create(0, 0, Style, null, "key"); Line = LineShape.Create(0, 0, Style, null); Path = PathShape.Create(Style, null); Point = PointShape.Create(); QuadraticBezier = QuadraticBezierShape.Create(0, 0, Style, null); Rectangle = RectangleShape.Create(0, 0, Style, null); Text = TextShape.Create(0, 0, Style, null, "Text"); // Path ArcSegment = ArcSegment.Create(PointShape.Create(), PathSize.Create(), 180, true, SweepDirection.Clockwise, true, true); CubicBezierSegment = CubicBezierSegment.Create(PointShape.Create(), PointShape.Create(), PointShape.Create(), true, true); LineSegment = LineSegment.Create(PointShape.Create(), true, true); PathFigure = PathFigure.Create(PointShape.Create(), false, true); PathGeometry = PathGeometry.Create(ImmutableArray.Create <PathFigure>(), FillRule.EvenOdd); PathSize = PathSize.Create(); PolyCubicBezierSegment = PolyCubicBezierSegment.Create(ImmutableArray.Create <PointShape>(), true, true); PolyLineSegment = PolyLineSegment.Create(ImmutableArray.Create <PointShape>(), true, true); PolyQuadraticBezierSegment = PolyQuadraticBezierSegment.Create(ImmutableArray.Create <PointShape>(), true, true); QuadraticBezierSegment = QuadraticBezierSegment.Create(PointShape.Create(), PointShape.Create(), true, true); }
public ActionResult GroupShapes(string Group1) { if (Group1 == null) { return(View()); } //Initialize Word document WordDocument doc = new WordDocument(); //Ensure Minimum doc.EnsureMinimal(); //Set margins for page. doc.LastSection.PageSetup.Margins.All = 72; //Create new group shape GroupShape groupShape = new GroupShape(doc); //Append AutoShape Shape shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; //Set horizontal origin shape.HorizontalOrigin = HorizontalOrigin.Page; //Set vertical origin shape.VerticalOrigin = VerticalOrigin.Page; //Set vertical position shape.VerticalPosition = 122; //Set horizontal position shape.HorizontalPosition = 220; //Set AllowOverlap to true for overlapping shapes shape.WrapFormat.AllowOverlap = true; //Set Fill Color shape.FillFormat.Color = System.Drawing.Color.Blue; //Set Content vertical alignment shape.TextFrame.TextVerticalAlignment = Syncfusion.DocIO.DLS.VerticalAlignment.Middle; //Add Texbody contents to Shape IWParagraph para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Requirement").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = System.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 167; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 212; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = System.Drawing.Color.Orange; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Design").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = System.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 257; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 302; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = System.Drawing.Color.Blue; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Execution").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = System.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 347; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 392; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = System.Drawing.Color.Violet; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Testing").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = System.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.DownArrow); shape.Width = 45; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 437; //Set horizontal position shape.HorizontalPosition = 265; shape.WrapFormat.AllowOverlap = true; groupShape.Add(shape); shape = new Shape(doc, AutoShapeType.RoundedRectangle); shape.Width = 130; shape.Height = 45; shape.HorizontalOrigin = HorizontalOrigin.Page; shape.VerticalOrigin = VerticalOrigin.Page; shape.VerticalPosition = 482; //Set horizontal position shape.HorizontalPosition = 220; shape.WrapFormat.AllowOverlap = true; shape.FillFormat.Color = System.Drawing.Color.PaleVioletRed; shape.TextFrame.TextVerticalAlignment = VerticalAlignment.Middle; para = shape.TextBody.AddParagraph(); para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; para.AppendText("Release").ApplyCharacterFormat(new WCharacterFormat(doc) { Bold = true, TextColor = System.Drawing.Color.White, FontSize = 12, FontName = "Verdana" }); groupShape.Add(shape); doc.LastParagraph.ChildEntities.Add(groupShape); #region save document //Save as .docx format if (Group1 == "WordDocx") { return(doc.ExportAsActionResult("Sample.docx", FormatType.Docx, HttpContext.ApplicationInstance.Response, HttpContentDisposition.Attachment)); } // Save as WordML(.xml) format else if (Group1 == "WordML") { return(doc.ExportAsActionResult("Sample.xml", FormatType.WordML, HttpContext.ApplicationInstance.Response, HttpContentDisposition.Attachment)); } //Save as .pdf format else if (Group1 == "Pdf") { DocToPDFConverter converter = new DocToPDFConverter(); PdfDocument pdfDoc = converter.ConvertToPDF(doc); return(pdfDoc.ExportAsActionResult("sample.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Save)); } #endregion return(View()); }
/// <summary> /// Called when a GroupShape is encountered in the document. /// </summary> public override VisitorAction VisitGroupShapeStart(GroupShape groupShape) { if (isHidden(groupShape)) groupShape.Remove(); return VisitorAction.Continue; }
private void button1_Click(object sender, System.EventArgs e) { try { //Creates a new Word document WordDocument document = new WordDocument(); //Adds new section to the document IWSection section = document.AddSection(); //Sets page setup options section.PageSetup.Orientation = PageOrientation.Landscape; section.PageSetup.Margins.All = 72; section.PageSetup.PageSize = new SizeF(792f, 612f); //Adds new paragraph to the section WParagraph paragraph = section.AddParagraph() as WParagraph; //Creates new group shape GroupShape groupShape = new GroupShape(document); //Adds group shape to the paragraph. paragraph.ChildEntities.Add(groupShape); //Create a RoundedRectangle shape with "Management" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(324f, 107.7f, 144f, 45f), 0, false, false, Color.FromArgb(50, 48, 142), "Management", groupShape, document); //Create a BentUpArrow shape to connect with "Development" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(177.75f, 176.25f, 210f, 50f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Sales" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(403.5f, 175.5f, 210f, 50f), 180, true, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Production" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(381f, 153f, 29.25f, 72.5f), 0, false, false, Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Development" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(135f, 226.45f, 110f, 40f), 0, false, false, Color.FromArgb(104, 57, 157), "Development", groupShape, document); //Create a RoundedRectangle shape with "Production" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(341f, 226.5f, 110f, 40f), 0, false, false, Color.FromArgb(149, 50, 118), "Production", groupShape, document); //Create a RoundedRectangle shape with "Sales" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(546.75f, 226.5f, 110f, 40f), 0, false, false, Color.FromArgb(179, 63, 62), "Sales", groupShape, document); //Create a DownArrow shape to connect with "Software" and "Hardware" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(177f, 265.5f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Series" and "Parts" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(383.25f, 265.5f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "North" and "South" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(588.75f, 266.25f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Software" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(129.5f, 286.5f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Hardware" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(190.5f, 286.5f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Series" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(336f, 287.25f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Parts" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(397f, 287.25f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "North" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(541.5f, 288f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "South" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(602.5f, 288f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Software" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(93f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "Software", groupShape, document); //Create a RoundedRectangle shape with "Hardware" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(197.2f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "Hardware", groupShape, document); //Create a RoundedRectangle shape with "Series" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(299.25f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "Series", groupShape, document); //Create a RoundedRectangle shape with "Parts" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(404.2f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "Parts", groupShape, document); //Create a RoundedRectangle shape with "North" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(505.5f, 321.75f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "North", groupShape, document); //Create a RoundedRectangle shape with "South" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(609.7f, 321.75f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "South", groupShape, document); //Save as docx format if (wordDocxRadioBtn.Checked) { //Saving the document as .docx document.Save("Sample.docx", FormatType.Docx); //Message box confirmation to view the created document. if (MessageBoxAdv.Show("Do you want to view the generated Word document?", "Document has been created", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { try { //Launching the MS Word file using the default Application.[MS Word Or Free WordViewer] #if NETCORE System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo = new System.Diagnostics.ProcessStartInfo("Sample.docx") { UseShellExecute = true }; process.Start(); #else System.Diagnostics.Process.Start("Sample.docx"); #endif //Exit this.Close(); } catch (Win32Exception ex) { MessageBoxAdv.Show("Microsoft Word Viewer or Microsoft Word is not installed in this system"); Console.WriteLine(ex.ToString()); } } } //Save as pdf format else if (pdfRadioBtn.Checked) { DocToPDFConverter converter = new DocToPDFConverter(); //Convert word document into PDF document PdfDocument pdfDoc = converter.ConvertToPDF(document); //Save the pdf file pdfDoc.Save("Sample.pdf"); //Message box confirmation to view the created document. if (MessageBoxAdv.Show("Do you want to view the generated PDF?", " Document has been created", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { try { #if NETCORE System.Diagnostics.Process process = new System.Diagnostics.Process(); process.StartInfo = new System.Diagnostics.ProcessStartInfo("Sample.pdf") { UseShellExecute = true }; process.Start(); #else System.Diagnostics.Process.Start("Sample.pdf"); #endif //Exit this.Close(); } catch (Exception ex) { MessageBoxAdv.Show("PDF Viewer is not installed in this system"); Console.WriteLine(ex.ToString()); } } } else { // Exit this.Close(); } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
public ActionResult GroupShapes(string Group1) { if (Group1 == null) { return(View()); } //Creates a new Word document WordDocument document = new WordDocument(); //Adds new section to the document IWSection section = document.AddSection(); //Sets page setup options section.PageSetup.Orientation = PageOrientation.Landscape; section.PageSetup.Margins.All = 72; section.PageSetup.PageSize = new SizeF(792f, 612f); //Adds new paragraph to the section WParagraph paragraph = section.AddParagraph() as WParagraph; //Creates new group shape GroupShape groupShape = new GroupShape(document); //Adds group shape to the paragraph. paragraph.ChildEntities.Add(groupShape); //Create a RoundedRectangle shape with "Management" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(324f, 107.7f, 144f, 45f), 0, false, false, Color.FromArgb(50, 48, 142), "Management", groupShape, document); //Create a BentUpArrow shape to connect with "Development" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(177.75f, 176.25f, 210f, 50f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Sales" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(403.5f, 175.5f, 210f, 50f), 180, true, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Production" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(381f, 153f, 29.25f, 72.5f), 0, false, false, Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Development" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(135f, 226.45f, 110f, 40f), 0, false, false, Color.FromArgb(104, 57, 157), "Development", groupShape, document); //Create a RoundedRectangle shape with "Production" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(341f, 226.5f, 110f, 40f), 0, false, false, Color.FromArgb(149, 50, 118), "Production", groupShape, document); //Create a RoundedRectangle shape with "Sales" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(546.75f, 226.5f, 110f, 40f), 0, false, false, Color.FromArgb(179, 63, 62), "Sales", groupShape, document); //Create a DownArrow shape to connect with "Software" and "Hardware" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(177f, 265.5f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "Series" and "Parts" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(383.25f, 265.5f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a DownArrow shape to connect with "North" and "South" shape CreateChildShape(AutoShapeType.DownArrow, new RectangleF(588.75f, 266.25f, 25.5f, 20.25f), 0, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Software" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(129.5f, 286.5f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Hardware" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(190.5f, 286.5f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Series" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(336f, 287.25f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "Parts" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(397f, 287.25f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "North" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(541.5f, 288f, 60f, 33f), 180, false, false, Color.White, null, groupShape, document); //Create a BentUpArrow shape to connect with "South" shape CreateChildShape(AutoShapeType.BentUpArrow, new RectangleF(602.5f, 288f, 60f, 33f), 180, true, false, Color.White, null, groupShape, document); //Create a RoundedRectangle shape with "Software" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(93f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "Software", groupShape, document); //Create a RoundedRectangle shape with "Hardware" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(197.2f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "Hardware", groupShape, document); //Create a RoundedRectangle shape with "Series" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(299.25f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "Series", groupShape, document); //Create a RoundedRectangle shape with "Parts" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(404.2f, 320.25f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "Parts", groupShape, document); //Create a RoundedRectangle shape with "North" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(505.5f, 321.75f, 90f, 40f), 0, false, false, Color.FromArgb(23, 187, 189), "North", groupShape, document); //Create a RoundedRectangle shape with "South" text CreateChildShape(AutoShapeType.RoundedRectangle, new RectangleF(609.7f, 321.75f, 90f, 40f), 0, false, false, Color.FromArgb(24, 159, 106), "South", groupShape, document); #region save document //Save as .docx format if (Group1 == "WordDocx") { return(document.ExportAsActionResult("Sample.docx", FormatType.Docx, HttpContext.ApplicationInstance.Response, HttpContentDisposition.Attachment)); } // Save as WordML(.xml) format else if (Group1 == "WordML") { return(document.ExportAsActionResult("Sample.xml", FormatType.WordML, HttpContext.ApplicationInstance.Response, HttpContentDisposition.Attachment)); } //Save as .pdf format else if (Group1 == "Pdf") { DocToPDFConverter converter = new DocToPDFConverter(); PdfDocument pdfDoc = converter.ConvertToPDF(document); return(pdfDoc.ExportAsActionResult("sample.pdf", HttpContext.ApplicationInstance.Response, HttpReadType.Save)); } #endregion return(View()); }