This Gist contains code snippets for sample code of Aspose.Diagram
Last active
February 21, 2017 13:53
-
-
Save aspose-diagram/cce69e51f567ea17ef24bc35fef0f689 to your computer and use it in GitHub Desktop.
This Gist contains .NET code snippets for examples of Aspose.Diagram for .NET.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Aspose.Diagram-for-.NET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// Set path of the license file, i.e. c:\temp\ | |
string dataDir = @"c:\temp\"; | |
License license = new License(); | |
license.SetLicense(dataDir + "Aspose.Diagram.lic"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// Set path of the license file, i.e. c:\temp\ | |
string dataDir = @"c:\temp\"; | |
// Load an existing Visio file in the stream | |
FileStream LicStream = new FileStream(dataDir + "Aspose.Diagram.lic", FileMode.Open); | |
License license = new License(); | |
license.SetLicense(LicStream); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initialize a Metered license class object | |
Aspose.Diagram.Metered metered = new Aspose.Diagram.Metered(); | |
// apply public and private keys | |
metered.SetMeteredKey("your-public-key", "your-private-key"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_EventSection(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "TestTemplate.vsdm"); | |
// Get page | |
Aspose.Diagram.Page page = diagram.Pages.GetPage(0); | |
// Get shape id | |
long shapeId = page.AddShape(3.0, 3.0, 0.36, 0.36, "Square"); | |
// Get shape | |
Aspose.Diagram.Shape shape = page.Shapes.GetShape(shapeId); | |
// Set event cells in the ShapeSheet | |
shape.Event.EventXFMod.Ufe.F = "CALLTHIS(\"ThisDocument.ShowAlert\")"; | |
shape.Event.EventDblClick.Ufe.F = "CALLTHIS(\"ThisDocument.ShowAlert\")"; | |
shape.Event.EventDrop.Ufe.F = "CALLTHIS(\"ThisDocument.ShowAlert\")"; | |
shape.Event.EventMultiDrop.Ufe.F = "CALLTHIS(\"ThisDocument.ShowAlert\")"; | |
shape.Event.TheText.Ufe.F = "CALLTHIS(\"ThisDocument.ShowAlert\")"; | |
shape.Event.TheData.Ufe.F = "CALLTHIS(\"ThisDocument.ShowAlert\")"; | |
// Save diagram | |
diagram.Save(dataDir + "SettingCellsInEventSection_out.vsdm", SaveFileFormat.VSDM); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Intro(); | |
// Load an existing Visio file in the stream | |
FileStream st = new FileStream(dataDir + "Drawing1.vsdx", FileMode.Open); | |
// Detect file format using the direct file path | |
FileFormatInfo info = FileFormatUtil.DetectFileFormat(dataDir + "Drawing1.vsdx"); | |
// Detect file format using the direct file path | |
FileFormatInfo infoFromStream = FileFormatUtil.DetectFileFormat(st); | |
// Get the detected file format | |
Console.WriteLine("The spreadsheet format is: " + info.FileFormatType); | |
// Get the detected file format from the file stream | |
Console.WriteLine("The spreadsheet format is (from the file stream): " + info.FileFormatType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Intro(); | |
// Build path of an existing diagram | |
string visioDrawing = dataDir + "Drawing1.vsdx"; | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(visioDrawing); | |
// Display Visio version and document modification time at different stages | |
Console.WriteLine("Visio Instance Version : " + diagram.Version); | |
Console.WriteLine("Full Build Number Created : " + diagram.DocumentProps.BuildNumberCreated); | |
Console.WriteLine("Full Build Number Edited : " + diagram.DocumentProps.BuildNumberEdited); | |
Console.WriteLine("Date Created : " + diagram.DocumentProps.TimeCreated); | |
Console.WriteLine("Date Last Edited : " + diagram.DocumentProps.TimeEdited); | |
Console.WriteLine("Date Last Printed : " + diagram.DocumentProps.TimePrinted); | |
Console.WriteLine("Date Last Saved : " + diagram.DocumentProps.TimeSaved); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Intro(); | |
// Build path of an existing diagram | |
string visioDrawing = dataDir + "Drawing1.vsdx"; | |
// Call the diagram constructor to load diagram from a VSDX file | |
Diagram diagram = new Diagram(visioDrawing); | |
// Set some summary information about the diagram | |
diagram.DocumentProps.Creator = "Ijaz"; | |
diagram.DocumentProps.Company = "Aspose"; | |
diagram.DocumentProps.Category = "Drawing 2D"; | |
diagram.DocumentProps.Manager = "Sergey Polshkov"; | |
diagram.DocumentProps.Title = "Aspose Title"; | |
diagram.DocumentProps.TimeCreated = DateTime.Now; | |
diagram.DocumentProps.Subject = "Visio Diagram"; | |
diagram.DocumentProps.Template = "Aspose Template"; | |
// Write the updated file to the disk in VSDX file format | |
diagram.Save(dataDir + "SetVisioProperties_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_KnowledgeBase(); | |
// Create a new diagram | |
Diagram diagram = new Diagram(dataDir + "Basic Shapes.vss"); | |
// Add a new rectangle shape | |
long shapeId = diagram.AddShape(4.25, 5.5, 2, 1, @"Rectangle", 0); | |
Shape shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
shape.Text.Value.Add(new Txt(@"Rectangle text.")); | |
// Add a new star shape | |
shapeId = diagram.AddShape(2.0, 5.5, 2, 2, @"Star 7", 0); | |
shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
shape.Text.Value.Add(new Txt(@"Star text.")); | |
// Add a new hexagon shape | |
shapeId = diagram.AddShape(7.0, 5.5, 2, 2, @"Hexagon", 0); | |
shape = diagram.Pages[0].Shapes.GetShape(shapeId); | |
shape.Text.Value.Add(new Txt(@"Hexagon text.")); | |
// Save the new diagram | |
diagram.Save(dataDir + "CreatingDiagramWithAspose_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_KnowledgeBase(); | |
Visio.Application vdxApp = null; | |
Visio.Document vdxDoc = null; | |
try | |
{ | |
// Create Visio Application Object | |
vdxApp = new Visio.Application(); | |
// Make Visio Application Invisible | |
vdxApp.Visible = false; | |
// Create a new diagram | |
vdxDoc = vdxApp.Documents.Add(""); | |
// Load Visio Stencil | |
Visio.Documents visioDocs = vdxApp.Documents; | |
Visio.Document visioStencil = visioDocs.OpenEx("Basic Shapes.vss", | |
(short)Microsoft.Office.Interop.Visio.VisOpenSaveArgs.visOpenHidden); | |
// Set active page | |
Visio.Page visioPage = vdxApp.ActivePage; | |
// Add a new rectangle shape | |
Visio.Master visioRectMaster = visioStencil.Masters.get_ItemU(@"Rectangle"); | |
Visio.Shape visioRectShape = visioPage.Drop(visioRectMaster, 4.25, 5.5); | |
visioRectShape.Text = @"Rectangle text."; | |
// Add a new star shape | |
Visio.Master visioStarMaster = visioStencil.Masters.get_ItemU(@"Star 7"); | |
Visio.Shape visioStarShape = visioPage.Drop(visioStarMaster, 2.0, 5.5); | |
visioStarShape.Text = @"Star text."; | |
// Add a new hexagon shape | |
Visio.Master visioHexagonMaster = visioStencil.Masters.get_ItemU(@"Hexagon"); | |
Visio.Shape visioHexagonShape = visioPage.Drop(visioHexagonMaster, 7.0, 5.5); | |
visioHexagonShape.Text = @"Hexagon text."; | |
// Save diagram as VDX | |
vdxDoc.SaveAs(dataDir + "CreatingDiagramWithVSTO_out.vdx"); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_KnowledgeBase(); | |
// Load an exiting Visio diagram | |
Diagram vsdDiagram = new Diagram(dataDir + "Drawing1.vsd"); | |
// Save the diagram as VDX | |
vsdDiagram.Save(dataDir + "SaveDiagramToVDXwithAspose_out.vdx", SaveFileFormat.VDX); | |
// Save as PDF | |
vsdDiagram.Save(dataDir + "SaveDiagramToPDFwithAspose_out.pdf", SaveFileFormat.PDF); | |
// Save as JPEG | |
vsdDiagram.Save(dataDir + "SaveDiagramToJPGwithAspose_out.jpg", SaveFileFormat.JPEG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_KnowledgeBase(); | |
// Create Visio Application Object | |
Visio.Application vsdApp = new Visio.Application(); | |
// Make Visio Application Invisible | |
vsdApp.Visible = false; | |
// Create a document object and load a diagram | |
Visio.Document vsdDoc = vsdApp.Documents.Open(dataDir + "Drawing1.vsd"); | |
// Save the VDX diagram | |
vsdDoc.SaveAs(dataDir + "SaveDiagramToVDXwithVSTO_out.vdx"); | |
// Save as PDF file | |
vsdDoc.ExportAsFixedFormat(Visio.VisFixedFormatTypes.visFixedFormatPDF, | |
dataDir + "SaveDiagramToPDFwithVSTO_out.pdf", Visio.VisDocExIntent.visDocExIntentScreen, | |
Visio.VisPrintOutRange.visPrintAll, 1, vsdDoc.Pages.Count, false, true, | |
true, true, true, System.Reflection.Missing.Value); | |
Visio.Page vsdPage = vsdDoc.Pages[1]; | |
// Save as JPEG Image | |
vsdPage.Export(dataDir + "SaveDiagramToJPGwithVSTO_out.jpg"); | |
// Quit Visio Object | |
vsdApp.Quit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
try | |
{ | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_KnowledgeBase(); | |
// Save the uploaded file as PDF | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsd"); | |
// Find a particular shape and update its properties | |
foreach (Aspose.Diagram.Shape shape in diagram.Pages[0].Shapes) | |
{ | |
if (shape.Name.ToLower() == "process1") | |
{ | |
shape.Text.Value.Clear(); | |
shape.Text.Value.Add(new Txt("Hello World")); | |
// Find custom style sheet and set as shape's text style | |
foreach (StyleSheet styleSheet in diagram.StyleSheets) | |
{ | |
if (styleSheet.Name == "CustomStyle1") | |
{ | |
shape.TextStyle = styleSheet; | |
} | |
} | |
// Set horizontal and vertical position of the shape | |
shape.XForm.PinX.Value = 5; | |
shape.XForm.PinY.Value = 5; | |
// Set height and width of the shape | |
shape.XForm.Height.Value = 2; | |
shape.XForm.Width.Value = 3; | |
} | |
} | |
// Save shape as VDX | |
diagram.Save(dataDir + "UpdateShapePropsWithAspose_out.vdx", SaveFileFormat.VDX); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_KnowledgeBase(); | |
Visio.Application vsdApp = null; | |
Visio.Document vsdDoc = null; | |
try | |
{ | |
// Create Visio Application Object | |
vsdApp = new Visio.Application(); | |
// Make Visio Application Invisible | |
vsdApp.Visible = false; | |
// Create a document object and load a diagram | |
vsdDoc = vsdApp.Documents.Open(dataDir + "Drawing1.vsd"); | |
// Create page object to get required page | |
Visio.Page page = vsdApp.ActivePage; | |
// Create shape object to get required shape | |
Visio.Shape shape = page.Shapes["Process1"]; | |
// Set shape text and text style | |
shape.Text = "Hello World"; | |
shape.TextStyle = "CustomStyle1"; | |
// Set shape's position | |
shape.get_Cells("PinX").ResultIU = 5; | |
shape.get_Cells("PinY").ResultIU = 5; | |
// Set shape's height and width | |
shape.get_Cells("Height").ResultIU = 2; | |
shape.get_Cells("Width").ResultIU = 3; | |
// Save file as VDX | |
vsdDoc.SaveAs(dataDir + "Drawing1.vdx"); | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// call the diagram constructor to load diagram from a VSD file | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// create an instance SVG save options class | |
SVGSaveOptions options = new SVGSaveOptions(); | |
ShapeCollection shapes = options.Shapes; | |
// get shapes by page index and shape ID, and then add in the shape collection object | |
shapes.Add(diagram.Pages[0].Shapes.GetShape(1)); | |
shapes.Add(diagram.Pages[0].Shapes.GetShape(2)); | |
// save Visio drawing | |
diagram.Save(dataDir + "SelectiveShapes_out.svg", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
public static void Run() | |
{ | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Create a new template | |
Diagram diagram = new Diagram(); | |
// Add master | |
diagram.Masters.Add(CreateMaster(101, "Regular", dataDir + "aspose-logo.jpg")); | |
// Save template | |
diagram.Save(dataDir + "CreateMasterFromScratch_out.vtx", SaveFileFormat.VTX); | |
} | |
// Create master | |
public static Master CreateMaster(int masterId, string name, string masterImage) | |
{ | |
// Set master properties | |
Master master = new Master(); | |
master.ID = masterId; | |
master.Name = name; | |
master.IconSize = IconSizeValue.Normal; | |
master.AlignName = AlignNameValue.AlignTextCenter; | |
master.MatchByName = BOOL.True; | |
master.IconUpdate = BOOL.True; | |
master.UniqueID = Guid.NewGuid(); | |
master.BaseID = Guid.NewGuid(); | |
master.PatternFlags = 1; | |
master.Hidden = BOOL.False; | |
// Set master's shape properties | |
Shape shape = new Shape(); | |
master.Shapes.Add(shape); | |
double width = 0.5443889263424177; | |
double height = 0.432916947568133; | |
shape.ID = 5; | |
shape.Type = TypeValue.Foreign; | |
shape.XForm.PinX.Value = 0.2221944631712089; | |
shape.XForm.PinY.Value = 0.1666458473784065; | |
shape.XForm.Width.Value = width; | |
shape.XForm.Height.Value = height; | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5"; | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5"; | |
shape.XForm.ResizeMode.Value = 0; | |
shape.TextXForm.TxtPinY.Ufe.F = "-TxtHeight/2"; | |
shape.TextXForm.TxtWidth.Ufe.F = "TEXTWIDTH(TheText)"; | |
shape.TextXForm.TxtHeight.Ufe.F = "TEXTHEIGHT(TheText, TxtWidth)"; | |
// Set connection properties | |
Connection connection = new Connection(); | |
shape.Connections.Add(connection); | |
connection.ID = 1; | |
connection.NameU = "All"; | |
connection.X.Value = 0.22; | |
connection.X.Ufe.F = "Width*0.5"; | |
connection.Y.Value = 0.16; | |
connection.Y.Ufe.F = "Height*0.5"; | |
connection.DirX.Value = 0; | |
connection.DirY.Value = 0; | |
connection.Type.Value = 0; | |
connection.AutoGen.Value = BOOL.False; | |
connection.Prompt.Ufe.F = "No Formula"; | |
shape.ForeignData.ForeignType = ForeignType.Bitmap; | |
shape.ForeignData.CompressionType = CompressionType.PNG; | |
shape.ForeignData.Value = ReadImageFile(masterImage); // EncodedImage.getBytes(); | |
return master; | |
} | |
// Get image bytes | |
public static byte[] ReadImageFile(string imageLocation) | |
{ | |
byte[] imageData = null; | |
FileInfo fileInfo = new FileInfo(imageLocation); | |
long imageFileLength = fileInfo.Length; | |
FileStream fs = new FileStream(imageLocation, FileMode.Open, FileAccess.Read); | |
BinaryReader br = new BinaryReader(fs); | |
imageData = br.ReadBytes((int)imageFileLength); | |
return imageData; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Initialize a Diagram class | |
Diagram diagram = new Diagram(); | |
// Save diagram in the VSDX format | |
diagram.Save(dataDir + "CreateNewVisio_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ExportToHTML.vsd"); | |
// Save resultant HTML directly to a stream | |
MemoryStream stream = new MemoryStream(); | |
diagram.Save(stream, SaveFileFormat.HTML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ExportPageToImage.vsd"); | |
// Save diagram as PNG | |
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.PNG); | |
// Save one page only, by page index | |
options.PageIndex = 0; | |
// Save resultant Image file | |
diagram.Save(dataDir + "ExportPageToImage_out.png", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ExportToHTML.vsd"); | |
// Save diagram | |
diagram.Save(dataDir + "outputVSDtoHTML.html", SaveFileFormat.HTML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load a VSD diagram | |
Diagram diagram = new Diagram(dataDir + "ExportToImage.vsd"); | |
// Save Image file | |
diagram.Save(dataDir + "ExportToImage_out.png", SaveFileFormat.PNG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load a VSD diagram | |
Diagram diagram = new Diagram(dataDir + "ExportToPDF.vsd"); | |
MemoryStream pdfStream = new MemoryStream(); | |
// Save diagram | |
diagram.Save(pdfStream, SaveFileFormat.PDF); | |
// Create a PDF file | |
FileStream pdfFileStream = new FileStream(dataDir + "ExportToPDF_out.pdf", FileMode.Create, FileAccess.Write); | |
pdfStream.WriteTo(pdfFileStream); | |
pdfFileStream.Close(); | |
pdfStream.Close(); | |
// Display Status. | |
System.Console.WriteLine("Conversion from vsd to pdf performed successfully."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load a VSD diagram | |
Diagram diagram = new Diagram(dataDir + "ExportToSVG.vsd"); | |
// Save SVG Output file | |
diagram.Save(dataDir + "Output.svg", SaveFileFormat.SVG); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ActvDir.vsd"); | |
// Save diagram | |
diagram.Save(dataDir + "Output_out.swf", SaveFileFormat.SWF); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ExportToXAML.vsd"); | |
// Save diagram | |
diagram.Save(dataDir + "ExportToXAML_out.xaml", SaveFileFormat.XAML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
/* 1. Exporting VSDX to VDX */ | |
// Call the diagram constructor to load diagram from a VSD file | |
Diagram diagram = new Diagram(dataDir + "ExportToXML.vsd"); | |
// Save input VSD as VDX | |
diagram.Save(dataDir + "ExportToXML_out.vdx", SaveFileFormat.VDX); | |
/* 2. Exporting from VSD to VSX */ | |
// Call the diagram constructor to load diagram from a VSD file | |
// Save input VSD as VSX | |
diagram.Save(dataDir + "ExportToXML_out.vsx", SaveFileFormat.VSX); | |
/* 3. Export VSD to VTX */ | |
// Save input VSD as VTX | |
diagram.Save(dataDir + "ExportToXML_out.vtx", SaveFileFormat.VTX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Open a VSD file | |
Diagram diagram = new Diagram(dataDir + "LayOutShapesInCompactTreeStyle.vdx"); | |
// Save diagram to an XPS format | |
diagram.Save(dataDir + "ExportToXPS_out.xps", SaveFileFormat.XPS); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load a VSD stream | |
FileStream st = new FileStream(dataDir + "Drawing1.vsdx", FileMode.Open); | |
Diagram vsdDiagram = new Diagram(st); | |
st.Close(); | |
// Call the diagram constructor to load a VDX diagram | |
Diagram vdxDiagram = new Diagram(dataDir + "Drawing1.vdx"); | |
/* | |
* Call diagram constructor to load a VSS stencil | |
* providing load file format | |
*/ | |
Diagram vssDiagram = new Diagram(dataDir + "Basic.vss", LoadFileFormat.VSS); | |
/* | |
* Call diagram constructor to load diagram from a VSX file | |
* providing load options | |
*/ | |
LoadOptions loadOptions = new LoadOptions(LoadFileFormat.VSX); | |
Diagram vsxDiagram = new Diagram(dataDir + "Drawing1.vsx", loadOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// load an existing Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// save diagram using the direct path | |
diagram.Save(dataDir + "SaveVisioDiagram_Out.vsdx", SaveFileFormat.VSDX); | |
MemoryStream stream = new MemoryStream(); | |
// save diagram in the stream | |
diagram.Save(stream, SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to a VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Options when saving a diagram into Visio format | |
DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VSDX); | |
// Summary: | |
// When characters in the diagram are unicode and not be set with correct font | |
// value or the font is not installed locally, they may appear as block, | |
// image or XPS. Set the DefaultFont such as MingLiu or MS Gothic to show these | |
// characters. | |
options.DefaultFont = "MS Gothic"; | |
// Summary: | |
// Defines whether need enlarge page to fit drawing content or not. | |
// Remarks: | |
// Default value is false. | |
options.AutoFitPageToDrawingContent = true; | |
diagram.Save(dataDir + "UseDiagramSaveOptions_out.vsdx", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to a VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Options when saving a diagram into the HTML format | |
HTMLSaveOptions options = new HTMLSaveOptions(); | |
// Summary: | |
// value or the font is not installed locally, they may appear as a block, | |
// set the DefaultFont such as MingLiu or MS Gothic to show these | |
// characters. | |
options.DefaultFont = "MS Gothic"; | |
// Sets the number of pages to render in HTML. | |
options.PageCount = 2; | |
// Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0; | |
// Set page size | |
PageSize pgSize = new PageSize(PaperSizeFormat.A1); | |
options.PageSize = pgSize; | |
// Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = true; | |
// Specify whether to include the toolbar or not. Default value is true. | |
options.SaveToolBar = false; | |
// Set title of the HTML document | |
options.Title = "Title goes here"; | |
// Save in any supported file format | |
diagram.Save(dataDir + "UseHTMLSaveOptions_out.html", options); | |
// Save resultant HTML directly to a stream | |
MemoryStream stream = new MemoryStream(); | |
diagram.Save(stream, SaveFileFormat.HTML); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to a VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
ImageSaveOptions options = new ImageSaveOptions(SaveFileFormat.JPEG); | |
// Specify the quality level to use during compositing. | |
options.CompositingQuality = Aspose.Diagram.Saving.CompositingQuality.HighQuality; | |
// Sets the brightness for the the generated images. | |
// This property has effect only when saving to raster image formats. | |
// The default value is 0.5. The value must be in the range between 0 and 1. | |
options.ImageBrightness = 1f; | |
// Summary: | |
// value or the font is not installed locally, they may appear as a block, | |
// set the DefaultFont such as MingLiu or MS Gothic to show these | |
// characters. | |
options.DefaultFont = "MS Gothic"; | |
// Sets the number of pages to render in image. | |
options.PageCount = 2; | |
// Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0; | |
// Set page size | |
PageSize pgSize = new PageSize(PaperSizeFormat.A1); | |
options.PageSize = pgSize; | |
// Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = true; | |
// Sets the color mode for the generated images. | |
options.ImageColorMode = ImageColorMode.BlackAndWhite; | |
// Sets the contrast for the generated images. | |
// This property has effect only when saving to raster image formats. | |
// The default value is 0.5. The value must be in the range between 0 and 1. | |
options.ImageContrast = 1f; | |
// Specify the algorithm that is used when images are scaled or rotated. | |
// This property has effect only when saving to raster image formats. | |
options.InterpolationMode = Aspose.Diagram.Saving.InterpolationMode.NearestNeighbor; | |
// The value may vary from 0 to 100 where 0 means worst quality, | |
// But maximum compression and 100 means best quality but minimum compression. | |
// The default value is 95. | |
options.JpegQuality = 100; | |
// Set a value specifying how pixels are offset during rendering. | |
options.PixelOffsetMode = Aspose.Diagram.Saving.PixelOffsetMode.HighSpeed; | |
// Sets the resolution for the generated images, in dots per inch. The default value is 96. | |
options.Resolution = 2f; | |
// Sets the zoom factor for the generated images. | |
// The default value is 1.0. The value must be greater than 0. | |
options.Scale = 1f; | |
// Specify whether smoothing (antialiasing) is applied to lines | |
// And curves and the edges of filled areas. | |
options.SmoothingMode = Aspose.Diagram.Saving.SmoothingMode.HighQuality; | |
// Sets the type of compression to apply when saving generated images to the TIFF format. | |
options.TiffCompression = TiffCompression.Ccitt3; | |
// Save in any supported file format | |
diagram.Save(dataDir + "UseImageSaveOptions_out.jpeg", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load diagram from a VSDX file | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Options when saving a diagram into the PDF format | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = true; | |
// Specify the quality of JPEG compression for images (if JPEG compression is used). Default is 95. | |
options.JpegQuality = 100; | |
// Specify default font name | |
options.DefaultFont = "Arial"; | |
// Conformance level for generated PDF document. | |
options.Compliance = PdfCompliance.Pdf15; | |
// Load the certificate from disk. | |
// The other constructor overloads can be used to load certificates from different locations. | |
X509Certificate2 cert = new X509Certificate2(dataDir + "certificate.pfx", "feyb4lgcfbme"); | |
// Sets a digital signature details. If not set, then no signing will be performed. | |
options.DigitalSignatureDetails = new PdfDigitalSignatureDetails(cert, "Test Signing", "Aspose Office", DateTime.Now, PdfDigitalSignatureHashAlgorithm.Sha512); | |
// Set encription details | |
PdfEncryptionDetails encriptionDetails = new PdfEncryptionDetails("user password", "Owner Password", PdfEncryptionAlgorithm.RC4_128); | |
options.EncryptionDetails = encriptionDetails; | |
// Sets the number of pages to render in PDF. | |
options.PageCount = 2; | |
// Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0; | |
// Set page size | |
PageSize pgSize = new PageSize(PaperSizeFormat.A1); | |
options.PageSize = pgSize; | |
// Save in any supported file format | |
diagram.Save(dataDir + "UsePDFSaveOptions_out.pdf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load diagram from a VSD file | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
SVGSaveOptions options = new SVGSaveOptions(); | |
// Summary: | |
// value or the font is not installed locally, they may appear as a block, | |
// set the DefaultFont such as MingLiu or MS Gothic to show these | |
// characters. | |
options.DefaultFont = "MS Gothic"; | |
// Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0; | |
// Set page size | |
PageSize pgSize = new PageSize(PaperSizeFormat.A1); | |
options.PageSize = pgSize; | |
diagram.Save(dataDir + "UseSVGSaveOptions_out.svg", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_LoadSaveConvert(); | |
// Call the diagram constructor to load diagram from a VSD file | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
SWFSaveOptions options = new SWFSaveOptions(); | |
// Summary: | |
// value or the font is not installed locally, they may appear as a block, | |
// set the DefaultFont such as MingLiu or MS Gothic to show these | |
// characters. | |
options.DefaultFont = "MS Gothic"; | |
// Sets the number of pages to render in SWF. | |
options.PageCount = 2; | |
// Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0; | |
// Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = true; | |
// Specify whether the generated SWF document should include the integrated document viewer or not. | |
options.ViewerIncluded = true; | |
diagram.Save(dataDir + "UseSWFSaveOptions_out.swf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_OLEObjects(); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page of the Visio diagram by name | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape of the Visio diagram by ID | |
Aspose.Diagram.Shape OLE_Shape = page.Shapes.GetShape(2); | |
// Filter shapes by type Foreign | |
if (OLE_Shape.Type == Aspose.Diagram.TypeValue.Foreign) | |
{ | |
if (OLE_Shape.ForeignData.ForeignType == ForeignType.Object) | |
{ | |
Stream Ole_stream = new MemoryStream(OLE_Shape.ForeignData.ObjectData); | |
// Get format of the OLE file object | |
Aspose.Words.FileFormatInfo info = Aspose.Words.FileFormatUtil.DetectFileFormat(Ole_stream); | |
if (info.LoadFormat == Aspose.Words.LoadFormat.Doc || info.LoadFormat == Aspose.Words.LoadFormat.Docx) | |
{ | |
// Modify an OLE object | |
var doc = new Aspose.Words.Document(new MemoryStream(OLE_Shape.ForeignData.ObjectData)); | |
doc.Range.Replace("testing", "Aspose", false, true); | |
MemoryStream outStream = new MemoryStream(); | |
doc.Save(outStream, Aspose.Words.SaveFormat.Docx); | |
// Save back an OLE object | |
OLE_Shape.ForeignData.ObjectData = outStream.ToArray(); | |
} | |
} | |
} | |
// Save Visio diagram | |
diagram.Save(dataDir + "ManipulateObjects_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Intro(); | |
String[] fontDirs = new String[] { "C:\\MyFonts\\", "D:\\Misc\\Fonts\\" }; | |
// Load the Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Setting the custom font directories | |
diagram.FontDirs = fontDirs; | |
// Saving Visio diagram in PDF format | |
diagram.Save(dataDir + "SpecifyFontLocation_out.pdf", SaveFileFormat.PDF); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeGradientFillData(); | |
// Load the Visio diagram | |
Diagram diagram = new Diagram(dataDir + "ShapewithGradientFill.vsdx"); | |
// get page by name | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1"); | |
// get shape by ID | |
Aspose.Diagram.Shape shape = page.Shapes.GetShape(1); | |
// get the gradient fill properties | |
GradientFill gradientfill = shape.Fill.GradientFill; | |
// get the gradient stops | |
GradientStopCollection stops = gradientfill.GradientStops; | |
// get the gradient stop by index | |
GradientStop stop = stops[0]; | |
// set gradient stop properties | |
stop.Color.Ufe.F = ""; | |
stop.Position.Value = 0.5; | |
gradientfill.GradientDir.Value = (int)GradientFillDir.RectangleFromBottomRight; | |
gradientfill.GradientAngle.Value = 0.7853981633974501; | |
// save the Visio drawing | |
diagram.Save(dataDir + "ShapewithGradientFill_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_TechnicalArticles(); | |
// Set license (you can add 10 shapes without setting a license) | |
// License lic = new License(); | |
// Lic.SetLicense(dataDir + "Aspose.Total.lic"); | |
// Load masters from any existing diagram, stencil or template | |
// And add in the new diagram | |
string visioStencil = dataDir + "AddConnectShapes.vss"; | |
// Names of the masters present in the stencil | |
string rectangleMaster = @"Rectangle", starMaster = @"Star 7", | |
hexagonMaster = @"Hexagon", connectorMaster = "Dynamic connector"; | |
int pageNumber = 0; | |
double width = 2, height = 2, pinX = 4.25, pinY = 9.5; | |
// Create a new diagram | |
Diagram diagram = new Diagram(visioStencil); | |
// Add a new rectangle shape | |
long rectangleId = diagram.AddShape( | |
pinX, pinY, width, height, rectangleMaster, pageNumber); | |
// Set the new shape's properties | |
Shape shape = diagram.Pages[pageNumber].Shapes.GetShape(rectangleId); | |
shape.Text.Value.Add(new Txt(@"Rectangle text.")); | |
shape.Name = "Rectangle1"; | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5"; | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5"; | |
shape.Line.LineColor.Value = "7"; | |
shape.Line.LineWeight.Value = 0.03; | |
shape.Fill.FillBkgnd.Value = "1"; | |
shape.Fill.FillForegnd.Value = "3"; | |
shape.Fill.FillPattern.Value = 31; | |
// Add a new star shape | |
pinX = 2.0; | |
pinY = 4.5; | |
long starId = diagram.AddShape( | |
pinX, pinY, width, height, starMaster, pageNumber); | |
// Set the star shape's properties | |
shape = diagram.Pages[pageNumber].Shapes.GetShape(starId); | |
shape.Text.Value.Add(new Txt(@"Star text.")); | |
shape.Name = "Star1"; | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5"; | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5"; | |
shape.Line.LineColor.Value = "#ff0000"; | |
shape.Line.LineWeight.Value = 0.03; | |
shape.Fill.FillBkgnd.Value = "#ff00ff"; | |
shape.Fill.FillForegnd.Value = "#0000ff"; | |
shape.Fill.FillPattern.Value = 31; | |
// Add a new hexagon shape | |
pinX = 7.0; | |
long hexagonId = diagram.AddShape( | |
pinX, pinY, width, height, hexagonMaster, pageNumber); | |
// Set the hexagon shape's properties | |
shape = diagram.Pages[pageNumber].Shapes.GetShape(hexagonId); | |
shape.Text.Value.Add(new Txt(@"Hexagon text.")); | |
shape.Name = "Hexagon1"; | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5"; | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5"; | |
shape.Line.LineWeight.Value = 0.03; | |
shape.Fill.FillPattern.Value = 31; | |
// Add master to dynamic connector from the stencil | |
diagram.AddMaster(visioStencil, connectorMaster); | |
// Connect rectangle and star shapes | |
Shape connector1 = new Shape(); | |
long connecter1Id = diagram.AddShape(connector1, connectorMaster, 0); | |
diagram.Pages[0].ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom, | |
starId, ConnectionPointPlace.Top, connecter1Id); | |
// Connect rectangle and hexagon shapes | |
Shape connector2 = new Shape(); | |
long connecter2Id = diagram.AddShape(connector2, connectorMaster, 0); | |
diagram.Pages[0].ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom, | |
hexagonId, ConnectionPointPlace.Left, connecter2Id); | |
// Save the diagram | |
diagram.Save(dataDir + "AddConnectShapes_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioActiveXControls(); | |
// Instantiate Diagram Object | |
Diagram diagram = new Diagram(); | |
// Insert an ActiveX control | |
diagram.Pages[0].AddActiveXControl(ControlType.Image, 1, 1, 1, 1); | |
// Save diagram | |
diagram.Save(dataDir + "InsertActiveXControl_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioActiveXControls(); | |
// Load and get a Visio page by name | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsd"); | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get a shape by ID | |
Shape shape = page.Shapes.GetShape(1); | |
// Get an ActiveX control | |
CommandButtonActiveXControl cbac = (CommandButtonActiveXControl)shape.ActiveXControl; | |
// Set width, height and caption of the command button control | |
cbac.Width = 4; | |
cbac.Height = 4; | |
cbac.Caption = "Test Button"; | |
// Save diagram | |
diagram.Save(dataDir + "RetrieveActiveXControl_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "BFlowcht.vsdx"); | |
// Use saving options | |
DiagramSaveOptions options = new DiagramSaveOptions(SaveFileFormat.VSDX); | |
// Set Auto fit page property | |
options.AutoFitPageToDrawingContent = true; | |
// Save Visio diagram | |
diagram.Save(dataDir + "AutoFitShapesInVisio_out.vsdx", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Create directory if it is not already present. | |
bool IsExists = System.IO.Directory.Exists(dataDir); | |
if (!IsExists) | |
System.IO.Directory.CreateDirectory(dataDir); | |
// Initialize a new Visio | |
Diagram diagram = new Diagram(); | |
dataDir = dataDir + "CreateDiagram_out.vsdx"; | |
// Save in the VSDX format | |
diagram.Save(dataDir, SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Instantiate Diagram Object and open VSD file | |
Diagram diagram = new Diagram(dataDir + "ExportToSWFWithoutViewer.vsd"); | |
// Instantiate the Save Options | |
SWFSaveOptions options = new SWFSaveOptions(); | |
// Set Save format as SWF | |
options.SaveFormat = SaveFileFormat.SWF; | |
// Exclude the embedded viewer | |
options.ViewerIncluded = false; | |
// Save the resultant SWF file | |
diagram.Save(dataDir + "ExportToSWFWithoutViewer_out.swf", SaveFileFormat.SWF); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
string fileName = "LayOutShapesInCompactTreeStyle.vdx"; | |
// Load an existing Visio diagram | |
Diagram diagram = new Diagram(dataDir + fileName); | |
// Set layout options | |
LayoutOptions compactTreeOptions = new LayoutOptions(); | |
compactTreeOptions.LayoutStyle = LayoutStyle.CompactTree; | |
compactTreeOptions.EnlargePage = true; | |
// Set layout direction as DownThenRight and then save | |
compactTreeOptions.Direction = LayoutDirection.DownThenRight; | |
diagram.Layout(compactTreeOptions); | |
diagram.Save(dataDir + "sample_down_right.vdx", SaveFileFormat.VDX); | |
// Set layout direction as DownThenLeft and then save | |
diagram = new Diagram(dataDir + fileName); | |
compactTreeOptions.Direction = LayoutDirection.DownThenLeft; | |
diagram.Layout(compactTreeOptions); | |
diagram.Save(dataDir + "sample_down_left.vdx", SaveFileFormat.VDX); | |
// Set layout direction as RightThenDown and then save | |
diagram = new Diagram(dataDir + fileName); | |
compactTreeOptions.Direction = LayoutDirection.RightThenDown; | |
diagram.Layout(compactTreeOptions); | |
diagram.Save(dataDir + "sample_right_down.vdx", SaveFileFormat.VDX); | |
// Set layout direction as LeftThenDown and then save | |
diagram = new Diagram(dataDir + fileName); | |
compactTreeOptions.Direction = LayoutDirection.LeftThenDown; | |
diagram.Layout(compactTreeOptions); | |
diagram.Save(dataDir + "sample_left_down.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Load an existing Visio diagram | |
string fileName = "LayOutShapesInFlowchartStyle.vdx"; | |
Diagram diagram = new Diagram(dataDir + fileName); | |
// Set layout options | |
LayoutOptions flowChartOptions = new LayoutOptions(); | |
flowChartOptions.LayoutStyle = LayoutStyle.FlowChart; | |
flowChartOptions.SpaceShapes = 1f; | |
flowChartOptions.EnlargePage = true; | |
// Set layout direction as BottomToTop and then save | |
flowChartOptions.Direction = LayoutDirection.BottomToTop; | |
diagram.Layout(flowChartOptions); | |
diagram.Save(dataDir + "sample_btm_top_out.vdx", SaveFileFormat.VDX); | |
// Set layout direction as TopToBottom and then save | |
diagram = new Diagram(dataDir + fileName); | |
flowChartOptions.Direction = LayoutDirection.TopToBottom; | |
diagram.Layout(flowChartOptions); | |
diagram.Save(dataDir + "sample_top_btm_out.vdx", SaveFileFormat.VDX); | |
// Set layout direction as LeftToRight and then save | |
diagram = new Diagram(dataDir + fileName); | |
flowChartOptions.Direction = LayoutDirection.LeftToRight; | |
diagram.Layout(flowChartOptions); | |
diagram.Save(dataDir + "sample_left_right_out.vdx", SaveFileFormat.VDX); | |
// Set layout direction as RightToLeft and then save | |
diagram = new Diagram(dataDir + fileName); | |
flowChartOptions.Direction = LayoutDirection.RightToLeft; | |
diagram.Layout(flowChartOptions); | |
diagram.Save(dataDir + "sample_right_left_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Load an existing Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdm", LoadFileFormat.VSDM); | |
// Extract VBA project | |
Aspose.Diagram.Vba.VbaProject v = diagram.VbaProject; | |
// Iterate through the modules and modify VBA module code | |
foreach (VbaModule module in diagram.VbaProject.Modules) | |
{ | |
string code = module.Codes; | |
if (code.Contains("This is test message.")) | |
code = code.Replace("This is test message.", "This is Aspose.Diagram message."); | |
module.Codes = code; | |
} | |
// Save the Visio diagram | |
diagram.Save(dataDir + "ModifyVBAModule_out.vssm", SaveFileFormat.VSSM); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Call the diagram constructor to load diagram from a VSD stream | |
FileStream st = new FileStream(dataDir + "ReadDiagramFile.vsd", FileMode.Open); | |
// Load diagram | |
Diagram vsdDiagram = new Diagram(st); | |
// Get pages count | |
System.Console.WriteLine("Total Pages:" + vsdDiagram.Pages.Count); | |
st.Close(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Remove all macros | |
diagram.VbProjectData = null; | |
// Save diagram | |
diagram.Save(dataDir + "RemoveMacrosFromVisio_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Call the diagram constructor to load diagram from a VSD file | |
Diagram vdxDiagram = new Diagram(dataDir + "RetrieveConnectorInfo.vsd"); | |
foreach (Aspose.Diagram.Connect connector in vdxDiagram.Pages[0].Connects) | |
{ | |
// Display information about the Connectors | |
Console.WriteLine("\nFrom Shape ID : " + connector.FromSheet); | |
Console.WriteLine("To Shape ID : " + connector.ToSheet); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Call the diagram constructor to load diagram from a VSD file | |
Diagram vdxDiagram = new Diagram(dataDir + "RetrieveFontInfo.vsd"); | |
foreach (Aspose.Diagram.Font font in vdxDiagram.Fonts) | |
{ | |
// Display information about the fonts | |
Console.WriteLine(font.Name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Diagrams(); | |
// Call the diagram constructor to load a VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by ID | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by ID | |
Shape shape = page.Shapes.GetShape(1); | |
// Get the fill formatting values | |
Console.WriteLine(shape.InheritFill.FillBkgnd.Value); | |
Console.WriteLine(shape.InheritFill.FillForegnd.Value); | |
Console.WriteLine(shape.InheritFill.FillPattern.Value); | |
Console.WriteLine(shape.InheritFill.ShapeShdwObliqueAngle.Value); | |
Console.WriteLine(shape.InheritFill.ShapeShdwOffsetX.Value); | |
Console.WriteLine(shape.InheritFill.ShapeShdwOffsetY.Value); | |
Console.WriteLine(shape.InheritFill.ShapeShdwScaleFactor.Value); | |
Console.WriteLine(shape.InheritFill.ShapeShdwType.Value); | |
Console.WriteLine(shape.InheritFill.ShdwBkgnd.Value); | |
Console.WriteLine(shape.InheritFill.ShdwBkgndTrans.Value); | |
Console.WriteLine(shape.InheritFill.ShdwForegnd.Value); | |
Console.WriteLine(shape.InheritFill.ShdwForegndTrans.Value); | |
Console.WriteLine(shape.InheritFill.ShdwPattern.Value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load a diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-2"); | |
// Add master with stencil file path and master name | |
string masterName = "Rectangle"; | |
diagram.AddMaster(dataDir + "Basic Shapes.vss", masterName); | |
// Page indexing starts from 0 | |
int PageIndex = 1; | |
double width = 2, height = 2, pinX = 4.25, pinY = 4.5; | |
// Add a new rectangle shape | |
long rectangleId = diagram.AddShape(pinX, pinY, width, height, masterName, PageIndex); | |
// Set shape properties | |
Shape rectangle = page.Shapes.GetShape(rectangleId); | |
rectangle.XForm.PinX.Value = 5; | |
rectangle.XForm.PinY.Value = 5; | |
rectangle.Type = TypeValue.Shape; | |
rectangle.Text.Value.Add(new Txt("Aspose Diagram")); | |
rectangle.TextStyle = diagram.StyleSheets[3]; | |
rectangle.Line.LineColor.Value = "#ff0000"; | |
rectangle.Line.LineWeight.Value = 0.03; | |
rectangle.Line.Rounding.Value = 0.1; | |
rectangle.Fill.FillBkgnd.Value = "#ff00ff"; | |
rectangle.Fill.FillForegnd.Value = "#ebf8df"; | |
diagram.Save(dataDir + "AddShape_out.vsdx", SaveFileFormat.VSDX); | |
Console.WriteLine("Shape has been added."); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get a group shape by ID and page index is 0 | |
Shape shape = diagram.Pages[0].Shapes.GetShape(795); | |
// Get a sub-shape of the group shape by id | |
Shape subShape = shape.Shapes.GetShape(794); | |
Matrix m = new Matrix(); | |
// Apply the translation vector | |
m.Translate(-(float)subShape.XForm.LocPinX.Value, -(float)subShape.XForm.LocPinY.Value); | |
// Set the elements of that matrix to a rotation | |
m.Rotate((float)subShape.XForm.Angle.Value); | |
// Apply the translation vector | |
m.Translate((float)subShape.XForm.PinX.Value, (float)subShape.XForm.PinY.Value); | |
// Get pinx and piny | |
double pinx = m.OffsetX; | |
double piny = m.OffsetY; | |
// Calculate the sub-shape pinx and piny | |
double resultx = shape.XForm.PinX.Value - shape.XForm.LocPinX.Value - pinx; | |
double resulty = shape.XForm.PinY.Value - shape.XForm.LocPinY.Value - piny; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by id | |
Shape shape = page.Shapes.GetShape(796); | |
// Alter the size of Shape | |
shape.SetWidth(2 * shape.XForm.Width.Value); | |
shape.SetHeight(2 * shape.XForm.Height.Value); | |
// Save diagram | |
diagram.Save(dataDir + "ChangeShapeSize_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx"); | |
int shapeid = 1; | |
// Get timeline shape | |
Shape timeline = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); | |
// Initialize TimeLineHlper object | |
Aspose.Diagram.TimeLineHelper timelineHelper = new TimeLineHelper(timeline); | |
// Set start time | |
timelineHelper.TimePeriodStart = new DateTime(2014, 12, 21); | |
// Set end time | |
timelineHelper.TimePeriodFinish = new DateTime(2015, 2, 19); | |
// Set date format | |
// TimelineHelper.DateFormatForBE = 21; | |
// Set date format for intm of timeline shape | |
// TimelineHelper.DateFormatForIntm = 21; | |
// Or | |
// Set date format string for start and finish of timeline shape | |
timelineHelper.DateFormatStringForBE = "yyyy-MM-dd"; | |
// Set date format string for intm of timeline shape | |
timelineHelper.DateFormatStringForIntm = "yyyy-MM-dd"; | |
// Save to VDX format | |
diagram.Save(dataDir + "ConfigureTimeLine_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// 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 + "DrawingTimeLine.vsdx"); | |
// 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 + "RefreshMilestone_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "DrawingTimeLine.vsdx"); | |
int shapeid = 1; | |
// Get timeline shape | |
Shape timeline = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); | |
// Initialize TimeLineHlper object | |
TimeLineHelper timelineHelper = new TimeLineHelper(timeline); | |
// Set start time | |
timelineHelper.TimePeriodStart = new DateTime(2014, 12, 21); | |
// Set end time | |
timelineHelper.TimePeriodFinish = new DateTime(2015, 2, 19); | |
// Set date format | |
timelineHelper.DateFormatForBE = 21; | |
// Revive milestones on the timeline | |
timelineHelper.RefreshTimeLine(); | |
// Save to VDX format | |
diagram.Save(dataDir + "RefreshTimeLine_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Set sub shape ids | |
long shapeFromId = 2; | |
long shapeToId = 4; | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Access a particular page | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Initialize connector shape | |
Shape shape = new Shape(); | |
shape.Line.EndArrow.Value = 4; | |
shape.Line.LineWeight.Value = 0.01388; | |
// Add shape | |
long connecter1Id = diagram.AddShape(shape, "Dynamic connector", page.ID); | |
// Connect sub-shapes | |
page.ConnectShapesViaConnector(shapeFromId, ConnectionPointPlace.Right, shapeToId, ConnectionPointPlace.Left, connecter1Id); | |
// Save Visio drawing | |
diagram.Save(dataDir + "ConnectVisioSubShapes_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load a source Visio | |
Diagram srcVisio = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Initialize a new Visio | |
Diagram newDiagram = new Diagram(); | |
// Add all masters from the source Visio diagram | |
MasterCollection originalMasters = srcVisio.Masters; | |
foreach (Master master in originalMasters) | |
newDiagram.AddMaster(srcVisio, master.Name); | |
// Get the page object from the original diagram | |
Aspose.Diagram.Page SrcPage = srcVisio.Pages.GetPage("Page-1"); | |
// Copy themes from the source diagram | |
newDiagram.CopyTheme(srcVisio); | |
// Copy pagesheet of the source Visio page | |
newDiagram.Pages[0].PageSheet.Copy(SrcPage.PageSheet); | |
// Copy shapes from the source Visio page | |
foreach (Aspose.Diagram.Shape shape in SrcPage.Shapes) | |
{ | |
newDiagram.Pages[0].Shapes.Add(shape); | |
} | |
// Save the new Visio | |
newDiagram.Save(dataDir + "CopyShapes_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get shape by id | |
Shape shape = diagram.Pages.GetPage("Page-3").Shapes.GetShape(16); | |
// Get connected shapes | |
long[] connectedShapeIds = shape.ConnectedShapes(ConnectedShapesFlags.ConnectedShapesAllNodes, null); | |
foreach (long id in connectedShapeIds) | |
{ | |
shape = diagram.Pages.GetPage("Page-3").Shapes.GetShape(id); | |
Console.WriteLine("ID: " + shape.ID + "\t\t Name: " + shape.Name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Initialize an array of shapes | |
Aspose.Diagram.Shape[] ss = new Aspose.Diagram.Shape[3]; | |
// Extract and assign shapes to the array | |
ss[0] = page.Shapes.GetShape(15); | |
ss[1] = page.Shapes.GetShape(16); | |
ss[2] = page.Shapes.GetShape(17); | |
// Mark array shapes as group | |
page.Shapes.Group(ss); | |
// Save visio diagram | |
diagram.Save(dataDir + "GroupShapes_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Get shape by id | |
Shape shape = page.Shapes.GetShape(16); | |
// Move shape from its position, it adds values in coordinates | |
shape.Move(1, 1); | |
// Save diagram | |
diagram.Save(dataDir + "MoveVisioShape_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
foreach (Aspose.Diagram.Shape shape in page.Shapes) | |
{ | |
if (shape.Name == "Process1") | |
{ | |
foreach (Prop property in shape.Props) | |
{ | |
Console.WriteLine(property.Label.Value + ": " + property.Value.Val); | |
} | |
break; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
foreach (Aspose.Diagram.Shape shape in page.Shapes) | |
{ | |
if (shape.Name == "Process1") | |
{ | |
Prop property = shape.Props.GetProp("Name1"); | |
Console.WriteLine(property.Label.Value + ": " + property.Value.Val); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Get a particular connector shape | |
Shape shape = page.Shapes.GetShape(18); | |
// Set reroute option | |
shape.Layout.ConFixedCode.Value = ConFixedCodeValue.NeverReroute; | |
// Save Visio diagram | |
diagram.Save(dataDir + "RerouteConnectors_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load diagram | |
Diagram vsdDiagram = new Diagram(dataDir + "RetrieveShapeInfo.vsd"); | |
foreach (Aspose.Diagram.Shape shape in vsdDiagram.Pages[0].Shapes) | |
{ | |
// Display information about the shapes | |
Console.WriteLine("\nShape ID : " + shape.ID); | |
Console.WriteLine("Name : " + shape.Name); | |
Console.WriteLine("Master Shape : " + shape.Master.Name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a sub-shape by page name, group shape ID, and then sub-shape ID | |
Shape shape = diagram.Pages.GetPage("Page-3").Shapes.GetShape(13).Shapes.GetShape(2); | |
Shape parentShape = shape.ParentShape; | |
Console.WriteLine("Parent Shape's Properties:"); | |
Console.WriteLine("Shape ID: " + parentShape.ID); | |
Console.WriteLine("Shape Name: " + parentShape.Name); | |
Console.WriteLine("Shape Type: " + parentShape.Type); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Get shape by id | |
Shape shape = page.Shapes.GetShape(16); | |
// Add a shape and set the angle | |
shape.SetAngle(190); | |
// Save diagram | |
diagram.Save(dataDir + "RotateVisioShape_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSDX diagram | |
Diagram srcVisio = new Diagram(dataDir + "Drawing1.vsdx"); | |
double shapeWidth = 0; | |
double shapeHeight = 0; | |
// Get Visio page | |
Aspose.Diagram.Page srcPage = srcVisio.Pages.GetPage("Page-3"); | |
// Remove background page | |
srcPage.BackPage = null; | |
// Get hash table of shapes, it holds id and name | |
Hashtable remShapes = new Hashtable(); | |
// Hashtable<Long, String> remShapes = new Hashtable<Long, String>(); | |
foreach (Aspose.Diagram.Shape shape in srcPage.Shapes) | |
// For the normal shape | |
remShapes.Add(shape.ID, shape.Name); | |
// Iterate through the hash table | |
foreach (DictionaryEntry shapeEntry in remShapes) | |
{ | |
long key = (long)shapeEntry.Key; | |
string val = (string)shapeEntry.Value; | |
Aspose.Diagram.Shape shape = srcPage.Shapes.GetShape(key); | |
// Check of the shape name | |
if (val.Equals("GroupShape1")) | |
{ | |
// Move shape to the origin corner | |
shapeWidth = shape.XForm.Width.Value; | |
shapeHeight = shape.XForm.Height.Value; | |
shape.MoveTo(shapeWidth * 0.5, shapeHeight * 0.5); | |
// Trim page size | |
srcPage.PageSheet.PageProps.PageWidth.Value = shapeWidth; | |
srcPage.PageSheet.PageProps.PageHeight.Value = shapeHeight; | |
} | |
else | |
{ | |
// Remove shape from the Visio page and hash table | |
srcPage.Shapes.Remove(shape); | |
} | |
} | |
remShapes.Clear(); | |
// Specify saving options | |
Aspose.Diagram.Saving.PdfSaveOptions opts = new Aspose.Diagram.Saving.PdfSaveOptions(); | |
// Set page count to save | |
opts.PageCount = 1; | |
// Set starting index of the page | |
opts.PageIndex = 1; | |
// Save it | |
srcVisio.Save(dataDir + "SaveVisioShapeInOtherFormats_out.pdf", opts); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsd"); | |
// Get a particular page | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Get a dynamic connector type shape by id | |
Shape shape = page.Shapes.GetShape(18); | |
// Set dynamic connector appearance | |
shape.SetConnectorsType(ConnectorsTypeValue.StraightLines); | |
// Saving Visio diagram | |
diagram.Save(dataDir + "SetConnectorAppearance_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "SetFillData.vsd"); | |
// Find a particular shape and update its XForm | |
foreach (Aspose.Diagram.Shape shape in diagram.Pages[0].Shapes) | |
{ | |
if (shape.NameU.ToLower() == "rectangle" && shape.ID == 1) | |
{ | |
shape.Fill.FillBkgnd.Value = diagram.Pages[1].Shapes[0].Fill.FillBkgnd.Value; | |
shape.Fill.FillForegnd.Value = "#ebf8df"; | |
} | |
} | |
// Save diagram | |
diagram.Save(dataDir + "SetFillData_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "SetLineData.vsd"); | |
// Get the page by its name | |
Aspose.Diagram.Page page1 = diagram.Pages.GetPage("Page-1"); | |
// Get shape by its ID | |
Aspose.Diagram.Shape shape = page1.Shapes.GetShape(1); | |
// Set line dash type by index | |
shape.Line.LinePattern.Value = 4; | |
// Set line weight, defualt in PT | |
shape.Line.LineWeight.Value = 2; | |
// Set color of the shape's line | |
shape.Line.LineColor.Ufe.F = "RGB(95,108,53)"; | |
// Set line rounding, default in inch | |
shape.Line.Rounding.Value = 0.3125; | |
// Set line caps | |
shape.Line.LineCap.Value = BOOL.True; | |
// Set line color transparency in percent | |
shape.Line.LineColorTrans.Value = 50; | |
/* add arrows to the connector or curve shapes */ | |
// Select arrow type by index | |
shape.Line.BeginArrow.Value = 4; | |
shape.Line.EndArrow.Value = 4; | |
// Set arrow size | |
shape.Line.BeginArrowSize.Value = ArrowSizeValue.Large; | |
shape.Line.BeginArrowSize.Value = ArrowSizeValue.Large; | |
// Save the Visio | |
diagram.Save(dataDir + "SetLineData_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "SetXFormdata.vsd"); | |
// Find a particular shape and update its XForm | |
foreach (Aspose.Diagram.Shape shape in diagram.Pages[0].Shapes) | |
{ | |
if (shape.NameU.ToLower() == "process" && shape.ID == 1) | |
{ | |
shape.XForm.PinX.Value = 5; | |
shape.XForm.PinY.Value = 5; | |
} | |
} | |
// Save diagram | |
diagram.Save(dataDir + "SetXFormdata_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Set two shape ids | |
long ShapeIdOne = 15; | |
long ShapeIdTwo = 16; | |
// Get Visio page by name | |
Page page = diagram.Pages.GetPage("Page-3"); | |
// Get Visio shapes by ids | |
Shape ShapedOne = page.Shapes.GetShape(ShapeIdOne); | |
Shape ShapedTwo = page.Shapes.GetShape(ShapeIdTwo); | |
// Determine whether shapes are connected | |
bool connected = ShapedOne.IsConnected(ShapedTwo); | |
Console.WriteLine("Shapes are connected: " + connected); | |
// Determine whether shapes are glued | |
bool glued = ShapedOne.IsGlued(ShapedTwo); | |
Console.WriteLine("Shapes are Glued: " + glued); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// get a sub-shape by page name, group shape ID, and then sub-shape ID | |
Shape shape = diagram.Pages.GetPage("Page-3").Shapes.GetShape(13).Shapes.GetShape(2); | |
Console.WriteLine("Is it in a Group: " + shape.IsInGroup()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load a VSD diagram | |
Diagram diagram = new Diagram(dataDir + "ExtractAllImagesFromPage.vsd"); | |
// Enter page index i.e. 0 for first one | |
foreach (Shape shape in diagram.Pages[0].Shapes) | |
{ | |
// Filter shapes by type Foreign | |
if (shape.Type == Aspose.Diagram.TypeValue.Foreign) | |
{ | |
using (System.IO.MemoryStream stream = new System.IO.MemoryStream(shape.ForeignData.Value)) | |
{ | |
// Load memory stream into bitmap object | |
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(stream); | |
// Save bmp here | |
bitmap.Save(dataDir + "ExtractAllImages" + shape.ID + "_out.bmp"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load stencil file to a diagram object | |
Diagram stencil = new Diagram(dataDir + "Timeline.vss"); | |
// Get master | |
Master master = stencil.Masters.GetMaster(1); | |
using (System.IO.MemoryStream stream = new System.IO.MemoryStream(master.Icon)) | |
{ | |
// Load memory stream into bitmap object | |
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(stream); | |
// Save as png format | |
bitmap.Save(dataDir + "MasterIcon_out.png", System.Drawing.Imaging.ImageFormat.Png); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Create a new diagram | |
Diagram diagram = new Diagram(); | |
// Get page object by index | |
Page page0 = diagram.Pages[0]; | |
// Set pinX, pinY, width and height | |
double pinX = 2, pinY = 2, width = 4, hieght = 3; | |
// Import Bitmap image as Visio shape | |
page0.AddShape(pinX, pinY, width, hieght, new FileStream(dataDir + "image.bmp", FileMode.OpenOrCreate)); | |
// Save Visio diagram | |
diagram.Save(dataDir + "InsertImageInVisio_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "ExtractAllImagesFromPage.vsd"); | |
// Convert image into bytes array | |
byte[] imageBytes = File.ReadAllBytes(dataDir + "Picture.png"); | |
// Enter page index i.e. 0 for first one | |
foreach (Shape shape in diagram.Pages[0].Shapes) | |
{ | |
// Filter shapes by type Foreign | |
if (shape.Type == Aspose.Diagram.TypeValue.Foreign) | |
{ | |
using (System.IO.MemoryStream stream = new System.IO.MemoryStream(shape.ForeignData.Value)) | |
{ | |
// Replace picture shape | |
shape.ForeignData.Value = imageBytes; | |
} | |
} | |
} | |
// Save diagram | |
diagram.Save(dataDir + "ReplaceShapePicture_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Call a Diagram class constructor to load the VSD diagram | |
Diagram diagram = new Diagram(dataDir + "RetrieveShapeInfo.vsd"); | |
// Get shape by an ID | |
Shape shape = diagram.Pages[0].Shapes.GetShape(90); | |
// Get all glued 1D shapes | |
long[] gluedShapeIds = shape.GluedShapes(GluedShapesFlags.GluedShapesAll1D, null, null); | |
// Display shape ID and name | |
foreach (long id in gluedShapeIds) | |
{ | |
shape = diagram.Pages[0].Shapes.GetShape(id); | |
Console.WriteLine("ID: " + shape.ID + "\t\t Name: " + shape.Name); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get a particular page | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// The ID of shape which is glue from Aspose.Diagram.Shape. | |
long shapeFromId = 779; | |
// The location on the first connection index where to glue | |
int shapeToBeginConnectionIndex = 72; | |
// The location on the end connection index where to glue | |
int shapeToEndConnectionIndex = 73; | |
// The ID of shape where to glue to Aspose.Diagram.Shape. | |
long shapeToId = 743; | |
// Glue shapes in container | |
page.GlueShapesInContainer(shapeFromId, shapeToBeginConnectionIndex, shapeToEndConnectionIndex, shapeToId); | |
// Glue shapes in container using connection name | |
// Page.GlueShapesInContainer(fasId, "U05L", "U05R", cabinetId1); | |
// Save diagram | |
diagram.Save(dataDir + "GlueContainerShape_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Shapes(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get a particular page | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Set shape id | |
long shape1_ID = 7; | |
long shape2_ID = 494; | |
// Glue shapes | |
page.GlueShapes(shape1_ID, Aspose.Diagram.Manipulation.ConnectionPointPlace.Center, shape2_ID); | |
// Save diagram | |
diagram.Save(dataDir + "GlueVisioShapes_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioComments(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Add comment | |
diagram.Pages[0].AddComment(7.205905511811023, 3.880708661417323, "test@"); | |
// Save diagram | |
diagram.Save(dataDir + "AddComment_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioComments(); | |
// Load Visio | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get collection of the annotations | |
AnnotationCollection annotations = diagram.Pages.GetPage("Page-1").PageSheet.Annotations; | |
// Iterate through the annotations | |
foreach (Annotation annotation in annotations) | |
{ | |
string comment = annotation.Comment.Value; | |
comment += "Updation mark"; | |
annotation.Comment.Value = comment; | |
} | |
// Save Visio | |
diagram.Save(dataDir + "EditComment_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ExternalDataSources(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsd"); | |
// Set connecting string | |
diagram.DataConnections[0].ConnectionString = "Data Source=MyServer;Initial Catalog=MyDB;Integrated Security=True"; | |
// Set command | |
diagram.DataConnections[0].Command = "SELECT * from Project with(nolock)"; | |
// Refresh all record sets | |
diagram.Refresh(); | |
// Save Visio diagram | |
diagram.Save(dataDir + "EditDataConAndRefreshRecords_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_GeometrySection(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Set connector shape by page name and ID | |
long connectorId = 4; | |
Shape connector = diagram.Pages.GetPage("Page-1").Shapes.GetShape(connectorId); | |
// Get connector geometry at index 0 | |
LineTo defaultLineTo = connector.Geoms[0].CoordinateCol.LineToCol[0]; | |
// Remove connector geometry from index 0 | |
connector.Geoms[0].CoordinateCol.LineToCol[0].Del = BOOL.True; | |
// Initialize LineTo geometry object | |
LineTo lineTo = new LineTo(); | |
// Set X value | |
lineTo.X.Value = 0; | |
// Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value / 2; | |
// Add connector geometry | |
connector.Geoms[0].CoordinateCol.Add(lineTo); | |
// Initialize LineTo geometry object | |
lineTo = new LineTo(); | |
// Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value / 2; | |
// Set X value | |
lineTo.X.Value = defaultLineTo.X.Value; | |
// Add connector geometry | |
connector.Geoms[0].CoordinateCol.Add(lineTo); | |
// Initialize LineTo geometry object | |
lineTo = new LineTo(); | |
// Set X value | |
lineTo.X.Value = defaultLineTo.X.Value; | |
// Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value; | |
// Add connector geometry | |
connector.Geoms[0].CoordinateCol.Add(lineTo); | |
// Save diagram in VDX format | |
diagram.Save(dataDir + "EditConnectorGeometry_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Hyperlinks(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by ID | |
Shape shape = page.Shapes.GetShape(2); | |
// Initialize Hyperlink object | |
Hyperlink hyperlink = new Hyperlink(); | |
// Set address value | |
hyperlink.Address.Value = "http:// Www.google.com/"; | |
// Set sub address value | |
hyperlink.SubAddress.Value = "Sub address here"; | |
// Set description value | |
hyperlink.Description.Value = "Description here"; | |
// Set name | |
hyperlink.Name = "MyHyperLink"; | |
// Add hyperlink to the shape | |
shape.Hyperlinks.Add(hyperlink); | |
// Save diagram to local space | |
diagram.Save(dataDir + "AddHyperlinkToShape_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Hyperlinks(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by ID | |
Shape shape = page.Shapes.GetShape(1); | |
// Iterate through the hyperlinks | |
foreach (Aspose.Diagram.Hyperlink hyperlink in shape.Hyperlinks) | |
{ | |
Console.WriteLine("Address: " + hyperlink.Address.Value); | |
Console.WriteLine("Sub Address: " + hyperlink.SubAddress.Value); | |
Console.WriteLine("Description: " + hyperlink.Description.Value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Layers(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get Visio page | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1"); | |
// Initialize a new Layer class object | |
Layer layer = new Layer(); | |
// Set Layer name | |
layer.Name.Value = "Layer1"; | |
// Set Layer Visibility | |
layer.Visible.Value = BOOL.True; | |
// Set the color checkbox of Layer | |
layer.IsColorChecked = BOOL.True; | |
// Add Layer to the particular page sheet | |
page.PageSheet.Layers.Add(layer); | |
// Get shape by ID | |
Shape shape = page.Shapes.GetShape(3); | |
// Assign shape to this new Layer | |
shape.LayerMem.LayerMember.Value = layer.IX.ToString(); | |
// Save diagram | |
diagram.Save(dataDir + "AddLayer_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Layers(); | |
// Load a source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Iterate through the shapes | |
foreach (Aspose.Diagram.Shape shape in page.Shapes) | |
{ | |
if (shape.Name.ToLower() == "shape1") | |
{ | |
// Add shape1 in first two layers. Here "0;1" are indexes of the layers | |
LayerMem layer = shape.LayerMem; | |
layer.LayerMember.Value = "0;1"; | |
} | |
else if (shape.Name.ToLower() == "shape2") | |
{ | |
// Remove shape2 from all the layers | |
LayerMem layer = shape.LayerMem; | |
layer.LayerMember.Value = ""; | |
} | |
else if (shape.Name.ToLower() == "shape3") | |
{ | |
// Add shape3 in first layer. Here "0" is index of the first layer | |
LayerMem layer = shape.LayerMem; | |
layer.LayerMember.Value = "0"; | |
} | |
} | |
// Save diagram | |
diagram.Save(dataDir + "ConfigureShapeLayers_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Layers(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get Visio page | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1"); | |
// Iterate through the layers | |
foreach (Layer layer in page.PageSheet.Layers) | |
{ | |
Console.WriteLine("Name: " + layer.Name.Value); | |
Console.WriteLine("Visibility: " + layer.Visible.Value); | |
Console.WriteLine("Status: " + layer.Status.Value); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Master(); | |
// Load diagram | |
Diagram diagram = new Diagram(); | |
// Load stencil to a stream | |
string templateFileName = dataDir + "NetApp-FAS-series.vss"; | |
Stream stream = new FileStream(templateFileName, FileMode.Open); | |
// Add master with stencil file path and master id | |
string masterName = "FAS80xx rear empty"; | |
diagram.AddMaster(templateFileName, 2); | |
// Add master with stencil file path and master name | |
diagram.AddMaster(templateFileName, masterName); | |
// Add master with stencil file stream and master id | |
diagram.AddMaster(stream, 2); | |
// Adds master to diagram from source diagram | |
Diagram src = new Diagram(templateFileName); | |
diagram.AddMaster(src, masterName); | |
// Add master with stencil file stream and master id | |
diagram.AddMaster(stream, masterName); | |
// Adds shape with defined PinX and PinY. | |
diagram.AddShape(2.0, 2.0, masterName, 0); | |
diagram.AddShape(6.0, 6.0, masterName, 0); | |
// Adds shape with defined PinX,PinY,Width and Height. | |
diagram.AddShape(7.0, 3.0, 1.5, 1.5, masterName, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Master(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(dataDir + "Basic Shapes.vss"); | |
// Check master by id | |
bool isPresent = diagram.Masters.IsExist(2); | |
Console.WriteLine("Master Presence : " + isPresent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Master(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(dataDir + "Basic Shapes.vss"); | |
// Set master name | |
string masterName = "VNXe3100 Storage Processor Rear"; | |
// Check master object by name | |
bool isPresent = diagram.Masters.IsExist(masterName); | |
Console.WriteLine("Master Presence : " + isPresent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Master(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(dataDir + "RetrieveMasterInfo.vdx"); | |
// Set master id | |
int masterid = 2; | |
// Get master object by id | |
Master master = diagram.Masters.GetMaster(masterid); | |
Console.WriteLine("Master ID : " + master.ID); | |
Console.WriteLine("Master Name : " + master.Name); | |
Console.WriteLine("Master Name : " + master.UniqueID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Master(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(dataDir + "Basic Shapes.vss"); | |
// Set master name | |
string masterName = "Circle"; | |
// Get master object by name | |
Master master = diagram.Masters.GetMasterByName(masterName); | |
Console.WriteLine("Master ID : " + master.ID); | |
Console.WriteLine("Master Name : " + master.Name); | |
Console.WriteLine("Master Name : " + master.UniqueID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Master(); | |
// Call a Diagram class constructor to load the VDX diagram | |
Diagram vdxDiagram = new Diagram(dataDir + "RetrieveMasterInfo.vdx"); | |
foreach (Aspose.Diagram.Master master in vdxDiagram.Masters) | |
{ | |
// Display information about the masters | |
Console.WriteLine("\nMaster ID : " + master.ID); | |
Console.WriteLine("Master Name : " + master.Name); | |
} | |
Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Initialize the new visio diagram | |
Diagram NewDigram = new Diagram(); | |
// Load source diagram | |
Diagram dgm = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Add all masters from the source Visio diagram | |
foreach (Master master in dgm.Masters) | |
NewDigram.Masters.Add(master); | |
// Get page object | |
Aspose.Diagram.Page SrcPage = dgm.Pages.GetPage("Page-1"); | |
// Set name | |
SrcPage.Name = "new page"; | |
// It calculates max page id | |
int max = 0; | |
if (NewDigram.Pages.Count != 0) | |
max = NewDigram.Pages[0].ID; | |
for (int i = 1; i < NewDigram.Pages.Count; i++) | |
{ | |
if (max < NewDigram.Pages[i].ID) | |
max = NewDigram.Pages[i].ID; | |
} | |
// Set max page ID | |
int MaxPageId = max; | |
// Set page ID | |
SrcPage.ID = MaxPageId + 1; | |
// Add page from the source diagram | |
NewDigram.Pages.Add(SrcPage); | |
// Remove first empty page | |
NewDigram.Pages.Remove(NewDigram.Pages[0]); | |
// Save diagram | |
NewDigram.Save(dataDir + "CopyVisioPage_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Set page id | |
int pageid = 2; | |
// Get page object by id | |
Page page2 = diagram.Pages.GetPage(pageid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Call the diagram constructor to load diagram from a VSDX file | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Set page name | |
string pageName = "Flow 2"; | |
// Get page object by name | |
Page page2 = diagram.Pages.GetPage(pageName); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// It calculates max page id | |
int max = 0; | |
if (diagram.Pages.Count != 0) | |
max = diagram.Pages[0].ID; | |
for (int i = 1; i < diagram.Pages.Count; i++) | |
{ | |
if (max < diagram.Pages[i].ID) | |
max = diagram.Pages[i].ID; | |
} | |
// Set max page ID | |
int MaxPageId = max; | |
// Initialize a new page object | |
Page newPage = new Page(); | |
// Set name | |
newPage.Name = "new page"; | |
// Set page ID | |
newPage.ID = MaxPageId + 1; | |
// Or try the Page constructor | |
// Page newPage = new Page(MaxPageId + 1); | |
// Add a new blank page | |
diagram.Pages.Add(newPage); | |
// Save diagram | |
diagram.Save(dataDir + "InsertBlankPage_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram vdxDiagram = new Diagram(dataDir + "RetrievePageInfo.vdx"); | |
foreach (Aspose.Diagram.Page page in vdxDiagram.Pages) | |
{ | |
// Checks if current page is a background page | |
if (page.Background == Aspose.Diagram.BOOL.True) | |
{ | |
// Display information about the background page | |
Console.WriteLine("Background Page ID : " + page.ID); | |
Console.WriteLine("Background Page Name : " + page.Name); | |
} | |
else | |
{ | |
// Display information about the foreground page | |
Console.WriteLine("\nPage ID : " + page.ID); | |
Console.WriteLine("Universal Name : " + page.NameU); | |
Console.WriteLine("ID of the Background Page : " + page.BackPage); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_VisioPages(); | |
// Initialize the new visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get Visio page | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Flow 1"); | |
// Page orientation | |
page.PageSheet.PrintProps.PrintPageOrientation.Value = PrintPageOrientationValue.Landscape; | |
// Save Visio | |
diagram.Save(dataDir + "SetPageOrientation_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Print(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Call the print method to print whole Diagram using the default printer | |
diagram.Print(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Print(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Call the print method to print whole Diagram using the printer name | |
diagram.Print("LaserJet1100"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Print(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Specify the name of the printer you want to print to. | |
const string printerName = @"\\COMPANY\Brother MFC-885CW Printer"; | |
// Print the document. | |
XpsPrintHelper.Print(diagram, printerName, "My Test Job", true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Print(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Call the print method to print whole Diagram using the printer name and set document name in the print job | |
diagram.Print("LaserJet1100", "Job name while printing with Aspose.Diagram"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
/// <summary> | |
/// Sends an Aspose.Diagram document to a printer using the XpsPrint API. | |
/// </summary> | |
/// <param name="diagram"></param> | |
/// <param name="printerName"></param> | |
/// <param name="jobName">Job name. Can be null.</param> | |
/// <param name="isWait">True to wait for the job to complete. False to return immediately after submitting the job.</param> | |
/// <exception cref="Exception">Thrown if any error occurs.</exception> | |
public static void Print(Diagram diagram, string printerName, string jobName, bool isWait) | |
{ | |
if (diagram == null) | |
throw new ArgumentNullException("document"); | |
// Use Aspose.Diagram to convert the document to XPS and store in a memory stream. | |
MemoryStream stream = new MemoryStream(); | |
diagram.Save(stream, SaveFileFormat.XPS); | |
stream.Position = 0; | |
Print(stream, printerName, jobName, isWait); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
/// <summary> | |
/// Sends a stream that contains a document in the XPS format to a printer using the XpsPrint API. | |
/// Has no dependency on Aspose.Diagram, can be used in any project. | |
/// </summary> | |
/// <param name="stream"></param> | |
/// <param name="printerName"></param> | |
/// <param name="jobName">Job name. Can be null.</param> | |
/// <param name="isWait">True to wait for the job to complete. False to return immediately after submitting the job.</param> | |
/// <exception cref="Exception">Thrown if any error occurs.</exception> | |
public static void Print(Stream stream, string printerName, string jobName, bool isWait) | |
{ | |
if (stream == null) | |
throw new ArgumentNullException("stream"); | |
if (printerName == null) | |
throw new ArgumentNullException("printerName"); | |
// Create an event that we will wait on until the job is complete. | |
IntPtr completionEvent = CreateEvent(IntPtr.Zero, true, false, null); | |
if (completionEvent == IntPtr.Zero) | |
throw new Win32Exception(); | |
try | |
{ | |
IXpsPrintJob job; | |
IXpsPrintJobStream jobStream; | |
StartJob(printerName, jobName, completionEvent, out job, out jobStream); | |
CopyJob(stream, job, jobStream); | |
if (isWait) | |
{ | |
WaitForJob(completionEvent); | |
CheckJobStatus(job); | |
} | |
} | |
finally | |
{ | |
if (completionEvent != IntPtr.Zero) | |
CloseHandle(completionEvent); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Protection(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ProtectAndUnprotect.vsd"); | |
diagram.DocumentSettings.ProtectBkgnds = BOOL.True; | |
diagram.DocumentSettings.ProtectMasters = BOOL.True; | |
diagram.DocumentSettings.ProtectShapes = BOOL.True; | |
diagram.DocumentSettings.ProtectStyles = BOOL.True; | |
// Save diagram | |
diagram.Save(dataDir + "VisioDiagramProtection_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_Protection(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "ProtectAndUnprotect.vsd"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Flow 1"); | |
// Get shape by ID | |
Shape shape = page.Shapes.GetShape(1); | |
// Set protections | |
shape.Protection.LockAspect.Value = BOOL.True; | |
shape.Protection.LockBegin.Value = BOOL.True; | |
shape.Protection.LockCalcWH.Value = BOOL.True; | |
shape.Protection.LockCrop.Value = BOOL.True; | |
shape.Protection.LockCustProp.Value = BOOL.True; | |
shape.Protection.LockDelete.Value = BOOL.True; | |
shape.Protection.LockEnd.Value = BOOL.True; | |
shape.Protection.LockFormat.Value = BOOL.True; | |
shape.Protection.LockFromGroupFormat.Value = BOOL.True; | |
shape.Protection.LockGroup.Value = BOOL.True; | |
shape.Protection.LockHeight.Value = BOOL.True; | |
shape.Protection.LockMoveX.Value = BOOL.True; | |
shape.Protection.LockMoveY.Value = BOOL.True; | |
shape.Protection.LockRotate.Value = BOOL.True; | |
shape.Protection.LockSelect.Value = BOOL.True; | |
shape.Protection.LockTextEdit.Value = BOOL.True; | |
shape.Protection.LockThemeColors.Value = BOOL.True; | |
shape.Protection.LockThemeEffects.Value = BOOL.True; | |
shape.Protection.LockVtxEdit.Value = BOOL.True; | |
shape.Protection.LockWidth.Value = BOOL.True; | |
// Save diagram | |
diagram.Save(dataDir + "VisioShapeProtection_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_SolutionXML(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Initialize SolutionXML object | |
SolutionXML solXML = new SolutionXML(); | |
// Set name | |
solXML.Name = "Solution XML"; | |
// Set xml value | |
solXML.XmlValue = "XML Value"; | |
// Add SolutionXML element | |
diagram.SolutionXMLs.Add(solXML); | |
// Save Visio diagram | |
diagram.Save(dataDir + "AddSolutionXMLElement_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_SolutionXML(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Iterate through SolutionXML elements | |
foreach (SolutionXML solutionXML in diagram.SolutionXMLs) | |
{ | |
// Get name property | |
Console.WriteLine(solutionXML.Name); | |
// Get xml value | |
Console.WriteLine(solutionXML.XmlValue); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeText(); | |
// Load diagram | |
Diagram vsdDiagram = new Diagram(dataDir + "ApplyCustomStyleSheets.vsd"); | |
// Get page by name | |
Page page = vsdDiagram.Pages.GetPage("Flow 1"); | |
Shape sourceShape = null; | |
// Find the shape to apply the style | |
foreach (Aspose.Diagram.Shape shape in page.Shapes) | |
{ | |
if (shape.Name == "Process") | |
{ | |
sourceShape = shape; | |
break; | |
} | |
} | |
StyleSheet customStyleSheet = null; | |
// Find the required style sheet | |
foreach (StyleSheet styleSheet in vsdDiagram.StyleSheets) | |
{ | |
if (styleSheet.Name == "Basic") | |
{ | |
customStyleSheet = styleSheet; | |
break; | |
} | |
} | |
if (sourceShape != null && customStyleSheet != null) | |
{ | |
// Apply text style | |
sourceShape.TextStyle = customStyleSheet; | |
// Apply fill style | |
sourceShape.FillStyle = customStyleSheet; | |
// Apply line style | |
sourceShape.LineStyle = customStyleSheet; | |
} | |
// Save changed diagram as VDX | |
vsdDiagram.Save(dataDir + "ApplyCustomStyleSheets_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeText(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by ID | |
Shape shape = page.Shapes.GetShape(1); | |
// Clear shape text values and chars | |
shape.Text.Value.Clear(); | |
shape.Chars.Clear(); | |
// Mark character run and add text | |
shape.Text.Value.Add(new Cp(0)); | |
shape.Text.Value.Add(new Txt("TextStyle_Regular\n")); | |
shape.Text.Value.Add(new Cp(1)); | |
shape.Text.Value.Add(new Txt("TextStyle_Bold_Italic\n")); | |
shape.Text.Value.Add(new Cp(2)); | |
shape.Text.Value.Add(new Txt("TextStyle_Underline_Italic\n")); | |
shape.Text.Value.Add(new Cp(3)); | |
shape.Text.Value.Add(new Txt("TextStyle_Bold_Italic_Underline")); | |
// Add formatting characters | |
shape.Chars.Add(new Aspose.Diagram.Char()); | |
shape.Chars.Add(new Aspose.Diagram.Char()); | |
shape.Chars.Add(new Aspose.Diagram.Char()); | |
shape.Chars.Add(new Aspose.Diagram.Char()); | |
// Set properties e.g. color, font, size and style etc. | |
shape.Chars[0].IX = 0; | |
shape.Chars[0].Color.Value = "#FF0000"; | |
shape.Chars[0].Font.Value = 4; | |
shape.Chars[0].Size.Value = 0.22; | |
shape.Chars[0].Style.Value = StyleValue.Undefined; | |
// Set properties e.g. color, font, size and style etc. | |
shape.Chars[1].IX = 1; | |
shape.Chars[1].Color.Value = "#FF00FF"; | |
shape.Chars[1].Font.Value = 4; | |
shape.Chars[1].Size.Value = 0.22; | |
shape.Chars[1].Style.Value = StyleValue.Bold | StyleValue.Italic; | |
// Set properties e.g. color, font, size and style etc. | |
shape.Chars[2].IX = 2; | |
shape.Chars[2].Color.Value = "#00FF00"; | |
shape.Chars[2].Font.Value = 4; | |
shape.Chars[2].Size.Value = 0.22; | |
shape.Chars[2].Style.Value = StyleValue.Underline | StyleValue.Italic; | |
// Set properties e.g. color, font, size and style etc. | |
shape.Chars[3].IX = 3; | |
shape.Chars[3].Color.Value = "#3333FF"; | |
shape.Chars[3].Font.Value = 4; | |
shape.Chars[3].Size.Value = 0.22; | |
shape.Chars[3].Style.Value = StyleValue.Bold | StyleValue.Italic | StyleValue.Underline; | |
// Save diagram | |
diagram.Save(dataDir + "ApplyFontOnText_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeTextBoxData(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get the page by its name | |
Aspose.Diagram.Page page1 = diagram.Pages.GetPage("Page-1"); | |
// Get shape by its ID | |
Aspose.Diagram.Shape shape = page1.Shapes.GetShape(1); | |
// Set orientation angle | |
DoubleValue margin = new DoubleValue(4, MeasureConst.PT); | |
// Set left, right, top and bottom margins of the shape's text block | |
shape.TextBlock.LeftMargin = margin; | |
shape.TextBlock.RightMargin = margin; | |
shape.TextBlock.TopMargin = margin; | |
shape.TextBlock.BottomMargin = margin; | |
// Set the text direction | |
shape.TextBlock.TextDirection.Value = TextDirectionValue.Vertical; | |
// Set the text alignment | |
shape.TextBlock.VerticalAlign.Value = VerticalAlignValue.Middle; | |
// Set the text block background color | |
shape.TextBlock.TextBkgnd.Ufe.F = "RGB(95,108,53)"; | |
// Set the background color transparency in percent | |
shape.TextBlock.TextBkgndTrans.Value = 50; | |
// Set the distance between default tab stops for the selected shape. | |
shape.TextBlock.DefaultTabStop.Value = 2; | |
// Save Visio | |
diagram.Save(dataDir + "FormatShapeTextBlockSection_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeTextBoxData(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get shape | |
long shapeid = 1; | |
Shape shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); | |
// Set text position at the bottom, | |
// TxtLocPinY = "TxtHeight*1" and TxtPinY = "Height*0" | |
shape.TextXForm.TxtLocPinY.Value = shape.TextXForm.TxtHeight.Value; | |
shape.TextXForm.TxtPinY.Value = 0; | |
// Set orientation angle | |
double angleDeg = 0; | |
double angleRad = (Math.PI / 180) * angleDeg; | |
shape.TextXForm.TxtAngle.Value = angleRad; | |
// Save Visio diagram in the local storage | |
diagram.Save(dataDir + "SetShapeTextPositionAtBottom_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeTextBoxData(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get shape | |
long shapeid = 1; | |
Shape shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); | |
// Set text position at the left, | |
// TxtLocPinX = "TxtWidth*1" and TxtPinX = "Width*0" | |
shape.TextXForm.TxtLocPinX.Value = shape.TextXForm.TxtWidth.Value; | |
shape.TextXForm.TxtPinX.Value = 0; | |
// Set orientation angle | |
double angleDeg = 0; | |
double angleRad = (Math.PI / 180) * angleDeg; | |
shape.TextXForm.TxtAngle.Value = angleRad; | |
// Save Visio diagram in the local storage | |
diagram.Save(dataDir + "SetShapeTextPositionAtLeft_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeTextBoxData(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get shape | |
long shapeid = 1; | |
Shape shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); | |
// Set text position at the right, | |
// TxtLocPinX = "TxtWidth*0" and TxtPinX = "Width*1" | |
shape.TextXForm.TxtLocPinX.Value = 0; | |
shape.TextXForm.TxtPinX.Value = shape.XForm.Width.Value; | |
// Set orientation angle | |
double angleDeg = 0; | |
double angleRad = (Math.PI / 180) * angleDeg; | |
shape.TextXForm.TxtAngle.Value = angleRad; | |
// Save Visio diagram in the local storage | |
diagram.Save(dataDir + "SetShapeTextPositionAtRight_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeTextBoxData(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get shape | |
long shapeid = 1; | |
Shape shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid); | |
// Set text position at the top, | |
// TxtLocPinY = "TxtHeight*0" and TxtPinY = "Height*1" | |
shape.TextXForm.TxtLocPinY.Value = 0; | |
shape.TextXForm.TxtPinY.Value = shape.XForm.Height.Value; | |
// Set orientation angle | |
double angleDeg = 0; | |
double angleRad = (Math.PI / 180) * angleDeg; | |
shape.TextXForm.TxtAngle.Value = angleRad; | |
// Save Visio diagram in the local storage | |
diagram.Save(dataDir + "SetShapeTextPositionAtTop_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeText(); | |
// Prepare a collection old and new text | |
Dictionary<string, string> replacements = new Dictionary<string, string>(); | |
replacements.Add("[[CompanyName]]", "Research Society of XYZ"); | |
replacements.Add("[[EmployeeName]]", "James Bond"); | |
replacements.Add("[[SubjectTitle]]", "The affect of the internet on social behavior in the industrialize world"); | |
replacements.Add("[[TimePeriod]]", DateTime.Now.AddYears(-1).ToString("dd/MMMM/yyyy") + " -- " + DateTime.Now.ToString("dd/MMMM/yyyy")); | |
replacements.Add("[[SubmissionDate]]", DateTime.Now.AddDays(-7).ToString("dd/MMMM/yyyy")); | |
replacements.Add("[[AmountReq]]", "$100,000"); | |
replacements.Add("[[DateApproved]]", DateTime.Now.AddDays(1).ToString("dd/MMMM/yyyy")); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "FindReplaceText.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Iterate through the shapes of a page | |
foreach (Shape shape in page.Shapes) | |
{ | |
foreach (KeyValuePair<string, string> kvp in replacements) | |
{ | |
foreach (FormatTxt txt in shape.Text.Value) | |
{ | |
Txt tx = txt as Txt; | |
if (tx != null && tx.Text.Contains(kvp.Key)) | |
{ | |
// Find and replace text of a shape | |
tx.Text = tx.Text.Replace(kvp.Key, kvp.Value); | |
} | |
} | |
} | |
} | |
// Save the diagram | |
diagram.Save(dataDir + "FindAndReplaceShapeText_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
static string text = ""; | |
public static void Run() | |
{ | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeText(); | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get Visio diagram page | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1"); | |
// Iterate through the shapes | |
foreach (Aspose.Diagram.Shape shape in page.Shapes) | |
{ | |
// Extract plain text from the shape | |
GetShapeText(shape); | |
} | |
// Display extracted text | |
Console.WriteLine(text); | |
} | |
private static void GetShapeText(Aspose.Diagram.Shape shape) | |
{ | |
// Filter shape text | |
if (shape.Text.Value.Text != "") | |
text += Regex.Replace(shape.Text.Value.Text, "\\<.*?>", ""); | |
// For image shapes | |
if (shape.Type == TypeValue.Foreign) | |
text += (shape.Name); | |
// For group shapes | |
if (shape.Type == TypeValue.Group) | |
foreach (Aspose.Diagram.Shape subshape in shape.Shapes) | |
{ | |
GetShapeText(subshape); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeText(); | |
// Create a new diagram | |
Diagram diagram = new Diagram(); | |
// Set parameters and add text to a Visio page | |
double PinX = 1, PinY = 1, Width = 1, Height = 1; | |
diagram.Pages[0].AddText(PinX, PinY, Width, Height, "Test text"); | |
// Save diagram | |
diagram.Save(dataDir + "InsertTextShape_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_ShapeText(); | |
// Call the diagram constructor to load diagram from a VDX file | |
Diagram diagram = new Diagram(dataDir + "UpdateShapeText.vsd"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Flow 1"); | |
// Find a particular shape and update its text | |
foreach (Aspose.Diagram.Shape shape in page.Shapes) | |
{ | |
if (shape.NameU.ToLower() == "process" && shape.ID == 1) | |
{ | |
shape.Text.Value.Clear(); | |
shape.Text.Value.Add(new Txt("New Text")); | |
} | |
} | |
// Save diagram | |
diagram.Save(dataDir + "UpdateShapeText_out.vdx", SaveFileFormat.VDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_UserDefinedCells(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by id | |
Shape shape = page.Shapes.GetShape(2); | |
// Initialize user object | |
User user = new User(); | |
user.Name = "UserDefineCell"; | |
user.Value.Val = "800"; | |
// Add user-defined cell | |
shape.Users.Add(user); | |
// Save diagram | |
diagram.Save(dataDir + "CreateUserDefinedCellInShapeSheet_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_UserDefinedCells(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get page by name | |
Page page = diagram.Pages.GetPage("Page-1"); | |
// Get shape by id | |
Shape shape = page.Shapes.GetShape(1); | |
// Extract user defined cells of the shape | |
foreach (User user in shape.Users) | |
{ | |
Console.WriteLine(user.Name + ": " + user.Value.Val); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_UserDefinedCells(); | |
int count = 0; | |
// Load diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Iterate through pages | |
foreach (Aspose.Diagram.Page objPage in diagram.Pages) | |
{ | |
// Iterate through shapes | |
foreach (Aspose.Diagram.Shape objShape in objPage.Shapes) | |
{ | |
Console.WriteLine(objShape.NameU); | |
// Iterate through user-defined cells | |
foreach (Aspose.Diagram.User objUserField in objShape.Users) | |
{ | |
count++; | |
Console.WriteLine(count + " - Name: " + objUserField.NameU + " Value: " + objUserField.Value.Val + " Prompt: " + objUserField.Prompt.Value); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_WindowElements(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get window object by index | |
Window window = diagram.Windows[0]; | |
// Check dynamic grid option | |
window.DynamicGridEnabled = BOOL.True; | |
// Check connection points option | |
window.ShowConnectionPoints = BOOL.True; | |
// Save visio drawing | |
diagram.Save(dataDir + "AddSupportOfVisualAids_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_WindowElements(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Initialize window object | |
Window window = new Window(); | |
// Set window state | |
window.WindowState = WindowStateValue.Maximized; | |
// Set window height | |
window.WindowHeight = 500; | |
// Set window width | |
window.WindowWidth = 500; | |
// Set window type | |
window.WindowType = WindowTypeValue.Stencil; | |
// Add window object | |
diagram.Windows.Add(window); | |
// Save in any supported format | |
diagram.Save(dataDir + "AddWindowElementInVisio_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_WindowElements(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Get window object by index | |
Window window = diagram.Windows[0]; | |
// Set visibility of grid | |
window.ShowGrid = BOOL.True; | |
// Set visibility of guides | |
window.ShowGuides = BOOL.True; | |
// Set visibility of rulers | |
window.ShowRulers = BOOL.True; | |
// Set visibility of page breaks | |
window.ShowPageBreaks = BOOL.True; | |
// Save diagram | |
diagram.Save(dataDir + "DisplayGridsRulersGuidesAndPageBreaks_out.vsdx", SaveFileFormat.VSDX); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir_WindowElements(); | |
// Load source Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
// Iterate through the window elements | |
foreach (Window window in diagram.Windows) | |
{ | |
Console.WriteLine("ID: " + window.ID); | |
Console.WriteLine("Type: " + window.WindowType); | |
Console.WriteLine("Window height: " + window.WindowHeight); | |
Console.WriteLine("Window width: " + window.WindowWidth); | |
Console.WriteLine("Window state: " + window.WindowState); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' Set path of the license file, i.e. c:\temp\ | |
Dim dataDir As String = "c:\temp\" | |
Dim license As New License() | |
license.SetLicense(dataDir & Convert.ToString("Aspose.Diagram.lic")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' Set path of the license file, i.e. c:\temp\ | |
Dim dataDir As String = "c:\temp\" | |
' Load an existing Visio file in the stream | |
Dim LicStream As New FileStream(dataDir & Convert.ToString("Aspose.Diagram.lic"), FileMode.Open) | |
Dim license As New License() | |
license.SetLicense(LicStream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_EventSection() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & "TestTemplate.vsdm") | |
' Get page | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage(0) | |
' Get shape id | |
Dim shapeId As Long = page.AddShape(3.0, 3.0, 0.36, 0.36, "Square") | |
' Get shape | |
Dim shape As Aspose.Diagram.Shape = page.Shapes.GetShape(shapeId) | |
' Set event cells in the ShapeSheet | |
shape.[Event].EventXFMod.Ufe.F = "CALLTHIS(""ThisDocument.ShowAlert"")" | |
shape.[Event].EventDblClick.Ufe.F = "CALLTHIS(""ThisDocument.ShowAlert"")" | |
shape.[Event].EventDrop.Ufe.F = "CALLTHIS(""ThisDocument.ShowAlert"")" | |
shape.[Event].EventMultiDrop.Ufe.F = "CALLTHIS(""ThisDocument.ShowAlert"")" | |
shape.[Event].TheText.Ufe.F = "CALLTHIS(""ThisDocument.ShowAlert"")" | |
shape.[Event].TheData.Ufe.F = "CALLTHIS(""ThisDocument.ShowAlert"")" | |
' Save diagram | |
diagram.Save(dataDir & "SettingCellsInEventSection_out.vsdm", SaveFileFormat.VSDM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Intro() | |
' Load an existing Visio file in the stream | |
Dim st As New FileStream(dataDir & Convert.ToString("Drawing1.vsdx"), FileMode.Open) | |
' Detect file format using the direct file path | |
Dim info As FileFormatInfo = FileFormatUtil.DetectFileFormat(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Detect file format using the direct file path | |
Dim infoFromStream As FileFormatInfo = FileFormatUtil.DetectFileFormat(st) | |
' Get the detected file format | |
Console.WriteLine("The spreadsheet format is: " & info.FileFormatType) | |
' Get the detected file format from the file stream | |
Console.WriteLine("The spreadsheet format is (from the file stream): " & info.FileFormatType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Intro() | |
' Build path of an existing diagram | |
Dim visioDrawing As String = dataDir & Convert.ToString("Drawing1.vsdx") | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(visioDrawing) | |
' Display Visio version and document modification time at different stages | |
Console.WriteLine("Visio Instance Version : " + diagram.Version) | |
Console.WriteLine("Full Build Number Created : " + diagram.DocumentProps.BuildNumberCreated) | |
Console.WriteLine("Full Build Number Edited : " + diagram.DocumentProps.BuildNumberEdited) | |
Console.WriteLine("Date Created : " + diagram.DocumentProps.TimeCreated.ToString()) | |
Console.WriteLine("Date Last Edited : " + diagram.DocumentProps.TimeEdited.ToString()) | |
Console.WriteLine("Date Last Printed : " + diagram.DocumentProps.TimePrinted.ToString()) | |
Console.WriteLine("Date Last Saved : " + diagram.DocumentProps.TimeSaved.ToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Intro() | |
' Build path of an existing diagram | |
Dim visioDrawing As String = dataDir & Convert.ToString("Drawing1.vsdx") | |
' Call the diagram constructor to load diagram from a VSDX file | |
Dim diagram As New Diagram(visioDrawing) | |
' Set some summary information about the diagram | |
diagram.DocumentProps.Creator = "Ijaz" | |
diagram.DocumentProps.Company = "Aspose" | |
diagram.DocumentProps.Category = "Drawing 2D" | |
diagram.DocumentProps.Manager = "Sergey Polshkov" | |
diagram.DocumentProps.Title = "Aspose Title" | |
diagram.DocumentProps.TimeCreated = DateTime.Now | |
diagram.DocumentProps.Subject = "Visio Diagram" | |
diagram.DocumentProps.Template = "Aspose Template" | |
' Write the updated file to the disk in VSDX file format | |
diagram.Save(dataDir & Convert.ToString("SetVisioProperties_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_KnowledgeBase() | |
' Create a new diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Basic Shapes.vss")) | |
' Add a new rectangle shape | |
Dim shapeId As Long = diagram.AddShape(4.25, 5.5, 2, 1, "Rectangle", 0) | |
Dim shape As Shape = diagram.Pages(0).Shapes.GetShape(shapeId) | |
shape.Text.Value.Add(New Txt("Rectangle text.")) | |
' Add a new star shape | |
shapeId = diagram.AddShape(2.0, 5.5, 2, 2, "Star 7", 0) | |
shape = diagram.Pages(0).Shapes.GetShape(shapeId) | |
shape.Text.Value.Add(New Txt("Star text.")) | |
' Add a new hexagon shape | |
shapeId = diagram.AddShape(7.0, 5.5, 2, 2, "Hexagon", 0) | |
shape = diagram.Pages(0).Shapes.GetShape(shapeId) | |
shape.Text.Value.Add(New Txt("Hexagon text.")) | |
' Save the new diagram | |
diagram.Save(dataDir & Convert.ToString("CreatingDiagramWithAspose_out.vdx"), SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_KnowledgeBase() | |
' Load an exiting Visio diagram | |
Dim vsdDiagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsd")) | |
' Save the diagram as VDX | |
vsdDiagram.Save(dataDir & Convert.ToString("SaveDiagramToVDXwithAspose_out.vdx"), SaveFileFormat.VDX) | |
' Save as PDF | |
vsdDiagram.Save(dataDir & Convert.ToString("SaveDiagramToPDFwithAspose_out.pdf"), SaveFileFormat.PDF) | |
' Save as JPEG | |
vsdDiagram.Save(dataDir & Convert.ToString("SaveDiagramToJPGwithAspose_out.jpg"), SaveFileFormat.JPEG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_KnowledgeBase() | |
' Create Visio Application Object | |
Dim vsdApp As New Visio.Application() | |
' Make Visio Application Invisible | |
vsdApp.Visible = False | |
' Create a document object and load a diagram | |
Dim vsdDoc As Visio.Document = vsdApp.Documents.Open(dataDir & Convert.ToString("Drawing1.vsd")) | |
' Save the VDX diagram | |
vsdDoc.SaveAs(dataDir & Convert.ToString("SaveDiagramToVDXwithVSTO_out.vdx")) | |
' Save as PDF file | |
vsdDoc.ExportAsFixedFormat(Visio.VisFixedFormatTypes.visFixedFormatPDF, dataDir & Convert.ToString("SaveDiagramToPDFwithVSTO_out.pdf"), Visio.VisDocExIntent.visDocExIntentScreen, Visio.VisPrintOutRange.visPrintAll, 1, vsdDoc.Pages.Count, _ | |
False, True, True, True, True, System.Reflection.Missing.Value) | |
Dim vsdPage As Visio.Page = vsdDoc.Pages(1) | |
' Save as JPEG Image | |
vsdPage.Export(dataDir & Convert.ToString("SaveDiagramToJPGwithVSTO_out.jpg")) | |
' Quit Visio Object | |
vsdApp.Quit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
Try | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_KnowledgeBase() | |
' Save the uploaded file as PDF | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsd")) | |
' Find a particular shape and update its properties | |
For Each shape As Aspose.Diagram.Shape In diagram.Pages(0).Shapes | |
If shape.Name.ToLower() = "process1" Then | |
shape.Text.Value.Clear() | |
shape.Text.Value.Add(New Txt("Hello World")) | |
' Find custom style sheet and set as shape' S text style | |
For Each styleSheet As StyleSheet In diagram.StyleSheets | |
If styleSheet.Name = "CustomStyle1" Then | |
shape.TextStyle = styleSheet | |
End If | |
Next | |
' Set horizontal and vertical position of the shape | |
shape.XForm.PinX.Value = 5 | |
shape.XForm.PinY.Value = 5 | |
' Set height and width of the shape | |
shape.XForm.Height.Value = 2 | |
shape.XForm.Width.Value = 3 | |
End If | |
Next | |
' Save shape as VDX | |
diagram.Save(dataDir & Convert.ToString("UpdateShapePropsWithAspose_out.vdx"), SaveFileFormat.VDX) | |
Catch ex As Exception | |
Console.WriteLine("This example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.") | |
End Try |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_KnowledgeBase() | |
Dim vsdApp As Visio.Application = Nothing | |
Dim vsdDoc As Visio.Document = Nothing | |
Try | |
' Create Visio Application Object | |
vsdApp = New Visio.Application() | |
' Make Visio Application Invisible | |
vsdApp.Visible = False | |
' Create a document object and load a diagram | |
vsdDoc = vsdApp.Documents.Open(dataDir & Convert.ToString("Drawing1.vsd")) | |
' Create page object to get required page | |
Dim page As Visio.Page = vsdApp.ActivePage | |
' Create shape object to get required shape | |
Dim shape As Visio.Shape = page.Shapes("Process1") | |
' Set shape text and text style | |
shape.Text = "Hello World" | |
shape.TextStyle = "CustomStyle1" | |
' Set shape' S position | |
' Shape.get() | |
' Shape.get_Cells("PinX").ResultIU = 5 | |
' Shape.get_Cells("PinY").ResultIU = 5 | |
' Set shape' S height and width | |
' Shape.get_Cells("Height").ResultIU = 2 | |
' Shape.get_Cells("Width").ResultIU = 3 | |
' Save file as VDX | |
vsdDoc.SaveAs(dataDir & Convert.ToString("Drawing1.vdx")) | |
Catch ex As Exception | |
Console.WriteLine("This example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.") | |
End Try |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' the path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' call the diagram constructor to load diagram from a VSD file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' create an instance SVG save options class | |
Dim options As New SVGSaveOptions() | |
Dim shapes As ShapeCollection = options.Shapes | |
' get shapes by page index and shape ID, and then add in the shape collection object | |
shapes.Add(diagram.Pages(0).Shapes.GetShape(1)) | |
shapes.Add(diagram.Pages(0).Shapes.GetShape(2)) | |
' save Visio drawing | |
diagram.Save(dataDir & Convert.ToString("SelectiveShapes_out.svg"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
Public Shared Sub Run() | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Create a new template | |
Dim diagram As New Diagram() | |
' Add master | |
diagram.Masters.Add(CreateMaster(101, "Regular", dataDir & Convert.ToString("aspose-logo.jpg"))) | |
' Save template | |
diagram.Save(dataDir & Convert.ToString("CreateMasterFromScratch_out.vtx"), SaveFileFormat.VTX) | |
End Sub | |
' Create master | |
Public Shared Function CreateMaster(masterId As Integer, name As String, masterImage As String) As Master | |
' Set master properties | |
Dim master As New Master() | |
master.ID = masterId | |
master.Name = name | |
master.IconSize = IconSizeValue.Normal | |
master.AlignName = AlignNameValue.AlignTextCenter | |
master.MatchByName = BOOL.[True] | |
master.IconUpdate = BOOL.[True] | |
master.UniqueID = Guid.NewGuid() | |
master.BaseID = Guid.NewGuid() | |
master.PatternFlags = 1 | |
master.Hidden = BOOL.[False] | |
' Set master's shape properties | |
Dim shape As New Shape() | |
master.Shapes.Add(shape) | |
Dim width As Double = 0.544388926342418 | |
Dim height As Double = 0.432916947568133 | |
shape.ID = 5 | |
shape.Type = TypeValue.Foreign | |
shape.XForm.PinX.Value = 0.222194463171209 | |
shape.XForm.PinY.Value = 0.166645847378406 | |
shape.XForm.Width.Value = width | |
shape.XForm.Height.Value = height | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5" | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5" | |
shape.XForm.ResizeMode.Value = 0 | |
shape.TextXForm.TxtPinY.Ufe.F = "-TxtHeight/2" | |
shape.TextXForm.TxtWidth.Ufe.F = "TEXTWIDTH(TheText)" | |
shape.TextXForm.TxtHeight.Ufe.F = "TEXTHEIGHT(TheText, TxtWidth)" | |
' Set connection properties | |
Dim connection As New Connection() | |
shape.Connections.Add(connection) | |
connection.ID = 1 | |
connection.NameU = "All" | |
connection.X.Value = 0.22 | |
connection.X.Ufe.F = "Width*0.5" | |
connection.Y.Value = 0.16 | |
connection.Y.Ufe.F = "Height*0.5" | |
connection.DirX.Value = 0 | |
connection.DirY.Value = 0 | |
connection.Type.Value = 0 | |
connection.AutoGen.Value = BOOL.[False] | |
connection.Prompt.Ufe.F = "No Formula" | |
shape.ForeignData.ForeignType = ForeignType.Bitmap | |
shape.ForeignData.CompressionType = CompressionType.PNG | |
shape.ForeignData.Value = ReadImageFile(masterImage) | |
' EncodedImage.getBytes(); | |
Return master | |
End Function | |
' Get image bytes | |
Public Shared Function ReadImageFile(imageLocation As String) As Byte() | |
Dim imageData As Byte() = Nothing | |
Dim fileInfo As New FileInfo(imageLocation) | |
Dim imageFileLength As Long = fileInfo.Length | |
Dim fs As New FileStream(imageLocation, FileMode.Open, FileAccess.Read) | |
Dim br As New BinaryReader(fs) | |
imageData = br.ReadBytes(CInt(imageFileLength)) | |
Return imageData | |
End Function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Initialize a Diagram class | |
Dim diagram As New Diagram() | |
' Save diagram in the VSDX format | |
diagram.Save(dataDir & Convert.ToString("CreateNewVisio_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("ExportToHTML.vsd")) | |
' Save resultant HTML directly to a stream | |
Dim stream As New MemoryStream() | |
diagram.Save(stream, SaveFileFormat.HTML) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & "ExportPageToImage.vsd") | |
' Save diagram as PNG | |
Dim options As New ImageSaveOptions(SaveFileFormat.PNG) | |
' Save one page only, by page index | |
options.PageIndex = 0 | |
' Save resultant Image file | |
diagram.Save(dataDir & "ExportPageToImage_out.png", options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & "ExportToHTML.vsd") | |
' Save diagra in the HTML format | |
diagram.Save(dataDir & "ExportToHTML_out.html", SaveFileFormat.HTML) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load a VSD diagram | |
Dim diagram As New Diagram(dataDir & "ExportToImage.vsd") | |
' Save Image file | |
diagram.Save(dataDir & "ExportToImage_out.png", SaveFileFormat.PNG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load a VSD diagram | |
Dim diagram As New Diagram(dataDir & "ExportToPDF.vsd") | |
Dim pdfStream As New MemoryStream() | |
diagram.Save(pdfStream, SaveFileFormat.PDF) | |
Dim pdfFileStream As New FileStream(dataDir & "ExportToPDF_out.pdf", FileMode.Create, FileAccess.Write) | |
pdfStream.WriteTo(pdfFileStream) | |
pdfFileStream.Close() | |
pdfStream.Close() | |
' Display Status. | |
System.Console.WriteLine("Conversion from vsd to pdf performed successfully.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load a VSD diagram | |
Dim diagram As New Diagram(dataDir & "ExportToSVG.vsd") | |
' Save diagram in the SVG format | |
diagram.Save(dataDir & "ExportToSVG_out.svg", SaveFileFormat.SVG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & "ActvDir.vsd") | |
' Save diagram |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("ExportToXAML.vsd")) | |
' Save diagram in the XAML format | |
diagram.Save(dataDir & Convert.ToString("Output.xaml"), SaveFileFormat.XAML) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' 1. | |
' Exporting VSD to VDX | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim diagram As New Diagram(dataDir & "ExportToXML.vsd") | |
' Save input VSD as VDX | |
diagram.Save(dataDir & "ExportToXML_out.vdx", SaveFileFormat.VDX) | |
' 2. | |
' Exporting from VSD to VSX | |
' Call the diagram constructor to load diagram from a VSD file | |
' Save input VSD as VSX | |
diagram.Save(dataDir & "ExportToXML_out.vsx", SaveFileFormat.VSX) | |
' 3. | |
' Export VSD to VTX | |
' Save input VSD as VTX | |
diagram.Save(dataDir & "ExportToXML_out.vtx", SaveFileFormat.VTX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Open VSD diagram | |
Dim diagram As New Diagram(dataDir & "ExportToXPS.vsd") | |
' Save diagram to XPS format | |
diagram.Save(dataDir & "Output.xps", SaveFileFormat.XPS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load a VSD stream | |
Dim st As New FileStream(dataDir & Convert.ToString("Drawing1.vsdx"), FileMode.Open) | |
Dim vsdDiagram As New Diagram(st) | |
st.Close() | |
' Call the diagram constructor to load a VDX diagram | |
Dim vdxDiagram As New Diagram(dataDir & Convert.ToString("Drawing1.vdx")) | |
' * Call diagram constructor to load a VSS stencil | |
' * providing load file format | |
Dim vssDiagram As New Diagram(dataDir & Convert.ToString("Basic.vss"), LoadFileFormat.VSS) | |
'* Call diagram constructor to load diagram from a VSX file | |
'* providing load options | |
Dim loadOptions As New LoadOptions(LoadFileFormat.VSX) | |
Dim vsxDiagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsx"), loadOptions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Load an existing Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Save diagram using the direct path | |
diagram.Save(dataDir & Convert.ToString("SaveVisioDiagram_out.vsdx"), SaveFileFormat.VSDX) | |
Dim stream As New MemoryStream() | |
' Save diagram in the stream | |
diagram.Save(stream, SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to a VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Options when saving a diagram into Visio format | |
Dim options As New DiagramSaveOptions(SaveFileFormat.VSDX) | |
' Summary: | |
' When characters in the diagram are unicode and not be set with correct font | |
' value or the font is not installed locally, they may appear as block, | |
' image or XPS. Set the DefaultFont such as MingLiu or MS Gothic to show these | |
' characters. | |
options.DefaultFont = "MS Gothic" | |
' Summary: | |
' Defines whether need enlarge page to fit drawing content or not. | |
' Remarks: | |
' Default value is false. | |
options.AutoFitPageToDrawingContent = True | |
diagram.Save(dataDir & Convert.ToString("UseDiagramSaveOptions_out.vsdx"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to a VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Options when saving a diagram into the HTML format | |
Dim options As New HTMLSaveOptions() | |
' Summary: | |
' value or the font is not installed locally, they may appear as a block, | |
' set the DefaultFont such as MingLiu or MS Gothic to show these | |
' characters. | |
options.DefaultFont = "MS Gothic" | |
' Sets the number of pages to render in HTML. | |
options.PageCount = 2 | |
' Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0 | |
' Set page size | |
Dim pgSize As New PageSize(PaperSizeFormat.A1) | |
options.PageSize = pgSize | |
' Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = True | |
' Specify whether to include the toolbar or not. Default value is true. | |
options.SaveToolBar = False | |
' Set title of the HTML document | |
options.Title = "Title goes here" | |
' Save in any supported file format | |
diagram.Save(dataDir & Convert.ToString("UseHTMLSaveOptions_out.html"), options) | |
' Save resultant HTML directly to a stream | |
Dim stream As New MemoryStream() | |
diagram.Save(stream, SaveFileFormat.HTML) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to a VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
Dim options As New ImageSaveOptions(SaveFileFormat.JPEG) | |
' Specify the quality level to use during compositing. | |
options.CompositingQuality = Aspose.Diagram.Saving.CompositingQuality.HighQuality | |
' Sets the brightness for the the generated images. | |
' This property has effect only when saving to raster image formats. | |
' The default value is 0.5. The value must be in the range between 0 and 1. | |
options.ImageBrightness = 1.0F | |
' Summary: | |
' value or the font is not installed locally, they may appear as a block, | |
' set the DefaultFont such as MingLiu or MS Gothic to show these | |
' characters. | |
options.DefaultFont = "MS Gothic" | |
' Sets the number of pages to render in image. | |
options.PageCount = 2 | |
' Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0 | |
' Set page size | |
Dim pgSize As New PageSize(PaperSizeFormat.A1) | |
options.PageSize = pgSize | |
' Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = True | |
' Sets the color mode for the generated images. | |
options.ImageColorMode = ImageColorMode.BlackAndWhite | |
' Sets the contrast for the generated images. | |
' This property has effect only when saving to raster image formats. | |
' The default value is 0.5. The value must be in the range between 0 and 1. | |
options.ImageContrast = 1.0F | |
' Specify the algorithm that is used when images are scaled or rotated. | |
' This property has effect only when saving to raster image formats. | |
options.InterpolationMode = Aspose.Diagram.Saving.InterpolationMode.NearestNeighbor | |
' The value may vary from 0 to 100 where 0 means worst quality, | |
' But maximum compression and 100 means best quality but minimum compression. | |
' The default value is 95. | |
options.JpegQuality = 100 | |
' Set a value specifying how pixels are offset during rendering. | |
options.PixelOffsetMode = Aspose.Diagram.Saving.PixelOffsetMode.HighSpeed | |
' Sets the resolution for the generated images, in dots per inch. The default value is 96. | |
options.Resolution = 2.0F | |
' Sets the zoom factor for the generated images. | |
' The default value is 1.0. The value must be greater than 0. | |
options.Scale = 1.0F | |
' Specify whether smoothing (antialiasing) is applied to lines | |
' And curves and the edges of filled areas. | |
options.SmoothingMode = Aspose.Diagram.Saving.SmoothingMode.HighQuality | |
' Sets the type of compression to apply when saving generated images to the TIFF format. | |
options.TiffCompression = TiffCompression.Ccitt3 | |
' Save in any supported file format | |
diagram.Save(dataDir & Convert.ToString("UseImageSaveOptions_out.jpeg"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Options when saving a diagram into the PDF format | |
Dim options As New PdfSaveOptions() | |
' Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = True | |
' Specify the quality of JPEG compression for images (if JPEG compression is used). Default is 95. | |
options.JpegQuality = 100 | |
' Specify default font name | |
options.DefaultFont = "Arial" | |
' Conformance level for generated PDF document. | |
options.Compliance = PdfCompliance.Pdf15 | |
' Load the certificate from disk. | |
' The other constructor overloads can be used to load certificates from different locations. | |
Dim cert As New X509Certificate2(dataDir & Convert.ToString("certificate.pfx"), "feyb4lgcfbme") | |
' Sets a digital signature details. If not set, then no signing will be performed. | |
options.DigitalSignatureDetails = New PdfDigitalSignatureDetails(cert, "Test Signing", "Aspose Office", DateTime.Now, PdfDigitalSignatureHashAlgorithm.Sha512) | |
' Set encription details | |
Dim encriptionDetails As New PdfEncryptionDetails("user password", "Owner Password", PdfEncryptionAlgorithm.RC4_128) | |
options.EncryptionDetails = encriptionDetails | |
' Sets the number of pages to render in PDF. | |
options.PageCount = 2 | |
' Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0 | |
' Set page size | |
Dim pgSize As New PageSize(PaperSizeFormat.A1) | |
options.PageSize = pgSize | |
' Save in any supported file format | |
diagram.Save(dataDir & Convert.ToString("UsePDFSaveOptions_out.pdf"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
Dim options As New SVGSaveOptions() | |
' Summary: | |
' value or the font is not installed locally, they may appear as a block, | |
' set the DefaultFont such as MingLiu or MS Gothic to show these | |
' characters. | |
options.DefaultFont = "MS Gothic" | |
' Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0 | |
' Set page size | |
Dim pgSize As New PageSize(PaperSizeFormat.A1) | |
options.PageSize = pgSize | |
diagram.Save(dataDir & Convert.ToString("UseSVGSaveOptions_out.svg"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_LoadSaveConvert() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
Dim options As New SWFSaveOptions() | |
' Summary: | |
' value or the font is not installed locally, they may appear as a block, | |
' set the DefaultFont such as MingLiu or MS Gothic to show these | |
' characters. | |
options.DefaultFont = "MS Gothic" | |
' Sets the number of pages to render in SWF. | |
options.PageCount = 2 | |
' Sets the 0-based index of the first page to render. Default is 0. | |
options.PageIndex = 0 | |
' Discard saving background pages of the Visio diagram | |
options.SaveForegroundPagesOnly = True | |
' Specify whether the generated SWF document should include the integrated document viewer or not. | |
options.ViewerIncluded = True | |
diagram.Save(dataDir & Convert.ToString("UseSWFSaveOptions_out.swf"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_OLEObjects() | |
' Load a Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page of the Visio diagram by name | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' Get shape of the Visio diagram by ID | |
Dim OLE_Shape As Aspose.Diagram.Shape = page.Shapes.GetShape(2) | |
' Filter shapes by type Foreign | |
If OLE_Shape.Type = Aspose.Diagram.TypeValue.Foreign Then | |
If OLE_Shape.ForeignData.ForeignType = ForeignType.[Object] Then | |
Dim Ole_stream As Stream = New MemoryStream(OLE_Shape.ForeignData.ObjectData) | |
' Get format of the OLE file object | |
Dim info As Aspose.Words.FileFormatInfo = Aspose.Words.FileFormatUtil.DetectFileFormat(Ole_stream) | |
If info.LoadFormat = Aspose.Words.LoadFormat.Doc OrElse info.LoadFormat = Aspose.Words.LoadFormat.Docx Then | |
' Modify an OLE object | |
Dim doc = New Aspose.Words.Document(New MemoryStream(OLE_Shape.ForeignData.ObjectData)) | |
doc.Range.Replace("testing", "Aspose", New FindReplaceOptions()) | |
Dim outStream As New MemoryStream() | |
doc.Save(outStream, Aspose.Words.SaveFormat.Docx) | |
' Save back an OLE object | |
OLE_Shape.ForeignData.ObjectData = outStream.ToArray() | |
End If | |
End If | |
End If | |
' Save Visio diagram | |
diagram.Save(dataDir & Convert.ToString("ManipulateObjects_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Intro() | |
Dim fontDirs As String() = New String() {"C:\MyFonts\", "D:\Misc\Fonts\"} | |
' Load the Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Setting the custom font directories | |
diagram.FontDirs = fontDirs | |
' Saving Visio diagram in PDF format | |
diagram.Save(dataDir & Convert.ToString("SetFontsFolders_out.pdf"), SaveFileFormat.PDF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeGradientFillData() | |
' Load the Visio diagram | |
Dim diagram As New Diagram(dataDir + "ShapewithGradientFill.vsdx") | |
' get page by name | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' get shape by ID | |
Dim shape As Aspose.Diagram.Shape = page.Shapes.GetShape(1) | |
' get the gradient fill properties | |
Dim gradientfill As GradientFill = shape.Fill.GradientFill | |
' get the gradient stops | |
Dim stops As GradientStopCollection = gradientfill.GradientStops | |
' get the gradient stop by index | |
Dim [stop] As GradientStop = stops(0) | |
' set gradient stop properties | |
[stop].Color.Ufe.F = "" | |
[stop].Position.Value = 0.5 | |
gradientfill.GradientDir.Value = CInt(GradientFillDir.RectangleFromBottomRight) | |
gradientfill.GradientAngle.Value = 0.78539816339745 | |
' save the Visio drawing | |
diagram.Save(dataDir + "ShapewithGradientFill_out.vsdx", SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_TechnicalArticles() | |
' Set license (you can add 10 shapes without setting a license) | |
' License lic = new License(); | |
' Lic.SetLicense(dataDir + "Aspose.Total.lic"); | |
' Load masters from any existing diagram, stencil or template | |
' And add in the new diagram | |
Dim visioStencil As String = dataDir & "AddConnectShapes.vss" | |
' Names of the masters present in the stencil | |
Dim rectangleMaster As String = "Rectangle", starMaster As String = "Star 7", hexagonMaster As String = "Hexagon", connectorMaster As String = "Dynamic connector" | |
Dim pageNumber As Integer = 0 | |
Dim width As Double = 2, height As Double = 2, pinX As Double = 4.25, pinY As Double = 9.5 | |
' Create a new diagram | |
Dim diagram As New Diagram(visioStencil) | |
' Add a new rectangle shape | |
Dim rectangleId As Long = diagram.AddShape(pinX, pinY, width, height, rectangleMaster, pageNumber) | |
' Set the new shape's properties | |
Dim shape As Shape = diagram.Pages(pageNumber).Shapes.GetShape(rectangleId) | |
shape.Text.Value.Add(New Txt("Rectangle text.")) | |
shape.Name = "Rectangle1" | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5" | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5" | |
shape.Line.LineColor.Value = "7" | |
shape.Line.LineWeight.Value = 0.03 | |
shape.Fill.FillBkgnd.Value = "1" | |
shape.Fill.FillForegnd.Value = "3" | |
shape.Fill.FillPattern.Value = 31 | |
' Add a new star shape | |
pinX = 2.0 | |
pinY = 4.5 | |
Dim starId As Long = diagram.AddShape(pinX, pinY, width, height, starMaster, pageNumber) | |
' Set the star shape' S properties | |
shape = diagram.Pages(pageNumber).Shapes.GetShape(starId) | |
shape.Text.Value.Add(New Txt("Star text.")) | |
shape.Name = "Star1" | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5" | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5" | |
shape.Line.LineColor.Value = "#ff0000" | |
shape.Line.LineWeight.Value = 0.03 | |
shape.Fill.FillBkgnd.Value = "#ff00ff" | |
shape.Fill.FillForegnd.Value = "#0000ff" | |
shape.Fill.FillPattern.Value = 31 | |
' Add a new hexagon shape | |
pinX = 7.0 | |
Dim hexagonId As Long = diagram.AddShape(pinX, pinY, width, height, hexagonMaster, pageNumber) | |
' Set the hexagon shape' S properties | |
shape = diagram.Pages(pageNumber).Shapes.GetShape(hexagonId) | |
shape.Text.Value.Add(New Txt("Hexagon text.")) | |
shape.Name = "Hexagon1" | |
shape.XForm.LocPinX.Ufe.F = "Width*0.5" | |
shape.XForm.LocPinY.Ufe.F = "Height*0.5" | |
shape.Line.LineWeight.Value = 0.03 | |
shape.Fill.FillPattern.Value = 31 | |
' Add master to dynamic connector from the stencil | |
diagram.AddMaster(visioStencil, connectorMaster) | |
' Connect rectangle and star shapes | |
Dim connector1 As New Shape() | |
Dim connecter1Id As Long = diagram.AddShape(connector1, connectorMaster, 0) | |
diagram.Pages(0).ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom, starId, ConnectionPointPlace.Top, connecter1Id) | |
' Connect rectangle and hexagon shapes | |
Dim connector2 As New Shape() | |
Dim connecter2Id As Long = diagram.AddShape(connector2, connectorMaster, 0) | |
diagram.Pages(0).ConnectShapesViaConnector(rectangleId, ConnectionPointPlace.Bottom, hexagonId, ConnectionPointPlace.Left, connecter2Id) | |
' Save the diagram | |
diagram.Save(dataDir & "AddConnectShapes_out.vsdx", SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioActiveXControls() | |
' Instantiate Diagram Object | |
Dim diagram As New Diagram() | |
' Insert an ActiveX control | |
diagram.Pages(0).AddActiveXControl(ControlType.Image, 1, 1, 1, 1) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("InsertActiveXControl_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioActiveXControls() | |
' Load and get a Visio page by name | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsd")) | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get a shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(1) | |
' Get an ActiveX control | |
Dim cbac As CommandButtonActiveXControl = DirectCast(shape.ActiveXControl, CommandButtonActiveXControl) | |
' Set width, height and caption of the command button control | |
cbac.Width = 4 | |
cbac.Height = 4 | |
cbac.Caption = "Test Button" | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("RetrieveActiveXControl_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Load a Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("BFlowcht.vsdx")) | |
' Use saving options | |
Dim options As New DiagramSaveOptions(SaveFileFormat.VSDX) | |
' Set Auto fit page property | |
options.AutoFitPageToDrawingContent = True | |
' Save Visio diagram | |
diagram.Save(dataDir & Convert.ToString("AutoFitShapesInVisio_out.vsdx"), options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Create directory if it is not already present. | |
Dim IsExists As Boolean = System.IO.Directory.Exists(dataDir) | |
If (Not IsExists) Then | |
System.IO.Directory.CreateDirectory(dataDir) | |
End If | |
Dim diagram As New Diagram() | |
diagram.Save(dataDir & "CreateDiagram_out.vsdx", SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Instantiate Diagram Object and open VSD file | |
Dim diagram As New Diagram(dataDir & "ExportToSWFWithoutViewer.vsd") | |
' Instantiate the Save Options | |
Dim options As New SWFSaveOptions() | |
' Set Save format as SWF | |
options.SaveFormat = SaveFileFormat.SWF | |
' Exclude the embedded viewer | |
options.ViewerIncluded = False | |
' Save the resultant SWF file | |
diagram.Save(dataDir & "ExportToSWFWithoutViewer_out.swf", SaveFileFormat.SWF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
Dim fileName As String = "LayOutShapesInCompactTreeStyle.vdx" | |
Dim diagram As New Diagram(dataDir & fileName) | |
Dim compactTreeOptions As New LayoutOptions() | |
compactTreeOptions.LayoutStyle = LayoutStyle.CompactTree | |
compactTreeOptions.EnlargePage = True | |
compactTreeOptions.Direction = LayoutDirection.DownThenRight | |
diagram.Layout(compactTreeOptions) | |
diagram.Save(dataDir & "sample_down_right.vdx", SaveFileFormat.VDX) | |
diagram = New Diagram(dataDir & fileName) | |
compactTreeOptions.Direction = LayoutDirection.DownThenLeft | |
diagram.Layout(compactTreeOptions) | |
diagram.Save(dataDir & "sample_down_left.vdx", SaveFileFormat.VDX) | |
diagram = New Diagram(dataDir & fileName) | |
compactTreeOptions.Direction = LayoutDirection.RightThenDown | |
diagram.Layout(compactTreeOptions) | |
diagram.Save(dataDir & "sample_right_down.vdx", SaveFileFormat.VDX) | |
diagram = New Diagram(dataDir & fileName) | |
compactTreeOptions.Direction = LayoutDirection.LeftThenDown | |
diagram.Layout(compactTreeOptions) | |
diagram.Save(dataDir & "sample_left_down.vdx", SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
Dim fileName As String = "LayOutShapesInFlowchartStyle.vdx" | |
Dim diagram As New Diagram(dataDir & fileName) | |
Dim flowChartOptions As New LayoutOptions() | |
flowChartOptions.LayoutStyle = LayoutStyle.FlowChart | |
flowChartOptions.SpaceShapes = 1.0F | |
flowChartOptions.EnlargePage = True | |
flowChartOptions.Direction = LayoutDirection.BottomToTop | |
diagram.Layout(flowChartOptions) | |
diagram.Save(dataDir & "sample_btm_top.vdx", SaveFileFormat.VDX) | |
diagram = New Diagram(dataDir & fileName) | |
flowChartOptions.Direction = LayoutDirection.TopToBottom | |
diagram.Layout(flowChartOptions) | |
diagram.Save(dataDir & "sample_top_btm.vdx", SaveFileFormat.VDX) | |
diagram = New Diagram(dataDir & fileName) | |
flowChartOptions.Direction = LayoutDirection.LeftToRight | |
diagram.Layout(flowChartOptions) | |
diagram.Save(dataDir & "sample_left_right.vdx", SaveFileFormat.VDX) | |
diagram = New Diagram(dataDir & fileName) | |
flowChartOptions.Direction = LayoutDirection.RightToLeft | |
diagram.Layout(flowChartOptions) | |
diagram.Save(dataDir & "sample_right_left.vdx", SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Load an existing Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdm"), LoadFileFormat.VSDM) | |
' Extract VBA project | |
Dim v As Aspose.Diagram.Vba.VbaProject = diagram.VbaProject | |
' Iterate through the modules and modify VBA module code | |
For Each [module] As VbaModule In diagram.VbaProject.Modules | |
Dim code As String = [module].Codes | |
If code.Contains("This is test message.") Then | |
code = code.Replace("This is test message.", "This is Aspose.Diagram message.") | |
End If | |
[module].Codes = code | |
Next | |
' Save the Visio diagram | |
diagram.Save(dataDir & Convert.ToString("ModifyVBAModule_out.vssm"), SaveFileFormat.VSSM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Call the diagram constructor to load a VSD stream | |
Dim st As New FileStream(dataDir & "ReadDiagramFile.vsd", FileMode.Open) | |
' Load diagram | |
Dim vsdDiagram As New Diagram(st) | |
' Get pages count | |
System.Console.WriteLine("Total Pages:" & vsdDiagram.Pages.Count) | |
st.Close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Load a Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Remove all macros | |
diagram.VbProjectData = Nothing | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("RemoveMacrosFromVisio_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim vdxDiagram As New Diagram(dataDir & "RetrieveConnectorInfo.vsd") | |
For Each connector As Aspose.Diagram.Connect In vdxDiagram.Pages(0).Connects | |
' Display information about the Connectors | |
Console.WriteLine(Constants.vbLf & "From Shape ID : " & connector.FromSheet) | |
Console.WriteLine("To Shape ID : " & connector.ToSheet) | |
Next connector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim vdxDiagram As New Diagram(dataDir & "RetrieveFontInfo.vsd") | |
For Each font As Aspose.Diagram.Font In vdxDiagram.Fonts | |
' Display information about the fonts | |
Console.WriteLine(font.Name) | |
Next font |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Diagrams() | |
' Call the diagram constructor to load a VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by ID | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(1) | |
' Get the fill formatting values | |
Console.WriteLine(shape.InheritFill.FillBkgnd.Value) | |
Console.WriteLine(shape.InheritFill.FillForegnd.Value) | |
Console.WriteLine(shape.InheritFill.FillPattern.Value) | |
Console.WriteLine(shape.InheritFill.ShapeShdwObliqueAngle.Value) | |
Console.WriteLine(shape.InheritFill.ShapeShdwOffsetX.Value) | |
Console.WriteLine(shape.InheritFill.ShapeShdwOffsetY.Value) | |
Console.WriteLine(shape.InheritFill.ShapeShdwScaleFactor.Value) | |
Console.WriteLine(shape.InheritFill.ShapeShdwType.Value) | |
Console.WriteLine(shape.InheritFill.ShdwBkgnd.Value) | |
Console.WriteLine(shape.InheritFill.ShdwBkgndTrans.Value) | |
Console.WriteLine(shape.InheritFill.ShdwForegnd.Value) | |
Console.WriteLine(shape.InheritFill.ShdwForegndTrans.Value) | |
Console.WriteLine(shape.InheritFill.ShdwPattern.Value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load a diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-2") | |
' Add master with stencil file path and master id | |
Dim masterName As String = "Rectangle" | |
' Add master with stencil file path and master name | |
diagram.AddMaster(dataDir & Convert.ToString("Basic Shapes.vss"), masterName) | |
' Page indexing starts from 0 | |
Dim PageIndex As Integer = 1 | |
Dim width As Double = 2, height As Double = 2, pinX As Double = 4.25, pinY As Double = 4.5 | |
' Add a new rectangle shape | |
Dim rectangleId As Long = diagram.AddShape(pinX, pinY, width, height, masterName, PageIndex) | |
' Set shape properties | |
Dim rectangle As Shape = page.Shapes.GetShape(rectangleId) | |
rectangle.XForm.PinX.Value = 5 | |
rectangle.XForm.PinY.Value = 5 | |
rectangle.Type = TypeValue.Shape | |
rectangle.Text.Value.Add(New Txt("Aspose Diagram")) | |
rectangle.TextStyle = diagram.StyleSheets(3) | |
rectangle.Line.LineColor.Value = "#ff0000" | |
rectangle.Line.LineWeight.Value = 0.03 | |
rectangle.Line.Rounding.Value = 0.1 | |
rectangle.Fill.FillBkgnd.Value = "#ff00ff" | |
rectangle.Fill.FillForegnd.Value = "#ebf8df" | |
diagram.Save(dataDir & Convert.ToString("AddShape_out.vsdx"), SaveFileFormat.VSDX) | |
Console.WriteLine("Shape has been added.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get a group shape by ID and page index is 0 | |
Dim shape As Shape = diagram.Pages(0).Shapes.GetShape(795) | |
' Get a sub-shape of the group shape by id | |
Dim subShape As Shape = shape.Shapes.GetShape(794) | |
Dim m As New Matrix() | |
' Apply the translation vector | |
m.Translate(-CSng(subShape.XForm.LocPinX.Value), -CSng(subShape.XForm.LocPinY.Value)) | |
' Set the elements of that matrix to a rotation | |
m.Rotate(CSng(subShape.XForm.Angle.Value)) | |
' Apply the translation vector | |
m.Translate(CSng(subShape.XForm.PinX.Value), CSng(subShape.XForm.PinY.Value)) | |
' Get pinx and piny | |
Dim pinx As Double = m.OffsetX | |
Dim piny As Double = m.OffsetY | |
' Calculate the sub-shape pinx and piny | |
Dim resultx As Double = shape.XForm.PinX.Value - shape.XForm.LocPinX.Value - pinx | |
Dim resulty As Double = shape.XForm.PinY.Value - shape.XForm.LocPinY.Value - piny |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by id | |
Dim shape As Shape = page.Shapes.GetShape(796) | |
' Alter the size of Shape | |
shape.SetWidth(2 * shape.XForm.Width.Value) | |
shape.SetHeight(2 * shape.XForm.Height.Value) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("ChangeShapeSize_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("DrawingTimeLine.vsdx")) | |
Dim shapeid As Integer = 1 | |
' Get timeline shape | |
Dim timeline As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Initialize TimeLineHlper object | |
Dim timelineHelper As Aspose.Diagram.TimeLineHelper = New TimeLineHelper(timeline) | |
' Set start time | |
timelineHelper.TimePeriodStart = New DateTime(2014, 12, 21) | |
' Set end time | |
timelineHelper.TimePeriodFinish = New DateTime(2015, 2, 19) | |
' Set date format | |
' TimelineHelper.DateFormatForBE = 21; | |
' Set date format for intm of timeline shape | |
' TimelineHelper.DateFormatForIntm = 21; | |
' Or | |
' Set date format string for start and finish of timeline shape | |
timelineHelper.DateFormatStringForBE = "yyyy-MM-dd" | |
' Set date format string for intm of timeline shape | |
timelineHelper.DateFormatStringForIntm = "yyyy-MM-dd" | |
' Save to VDX format | |
diagram.Save(dataDir & Convert.ToString("ConfigureTimeLine_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Modify time line | |
Dim startDate As New DateTime(2015, 8, 1) | |
Dim endDate As New DateTime(2016, 6, 1) | |
Dim fisYear As DateTime = startDate | |
Dim pageName As String = "Page-1" | |
' Load a diagram | |
Dim diagram As New Diagram(dataDir & "DrawingTimeLine.vsdx") | |
' Get page | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage(pageName) | |
Dim timelineId As Long = 1 | |
Dim timeline As Shape = diagram.Pages.GetPage(pageName).Shapes.GetShape(timelineId) | |
Dim xpos As Double = timeline.XForm.PinX.Value | |
Dim ypos As Double = timeline.XForm.PinY.Value | |
' Add milestone | |
Dim milestoneMasterName As String = "2 triangle milestone" | |
' Add Master | |
diagram.AddMaster(dataDir & "Timeline.vss", milestoneMasterName) | |
' Add Shape in Visio diagram using AddShape method | |
Dim milestoneShapeId As Long = diagram.AddShape(xpos, ypos, milestoneMasterName, 0) | |
' Get the shape based on ID | |
Dim milestone As Shape = page.Shapes.GetShape(milestoneShapeId) | |
' Instantiate MilestoneHelper object | |
Dim milestoneHelper As 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) | |
diagram.Save(dataDir & "RefreshMilestone_out.vsdx", SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("DrawingTimeLine.vsdx")) | |
Dim shapeid As Integer = 1 | |
' Get timeline shape | |
Dim timeline As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Initialize TimeLineHlper object | |
Dim timelineHelper As New TimeLineHelper(timeline) | |
' Set start time | |
timelineHelper.TimePeriodStart = New DateTime(2014, 12, 21) | |
' Set end time | |
timelineHelper.TimePeriodFinish = New DateTime(2015, 2, 19) | |
' Set date format | |
timelineHelper.DateFormatForBE = 21 | |
'revive milestones on the timeline | |
timelineHelper.RefreshTimeLine() | |
' Save to VDX format | |
diagram.Save(dataDir & Convert.ToString("RefreshTimeLine_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("DrawingTimeLine.vsdx")) | |
Dim shapeid As Integer = 22 | |
' Get timeline shape | |
Dim milestone As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Initialize MilestoneHelper object | |
Dim milestoneHelper As Aspose.Diagram.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 & Convert.ToString("SetMilestoneProps_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Set sub shape ids | |
Dim shapeFromId As Long = 2 | |
Dim shapeToId As Long = 4 | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Access a particular page | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Initialize connector shape | |
Dim shape As New Shape() | |
shape.Line.EndArrow.Value = 4 | |
shape.Line.LineWeight.Value = 0.01388 | |
' Add shape | |
Dim connecter1Id As Long = diagram.AddShape(shape, "Dynamic connector", page.ID) | |
' Connect sub-shapes | |
page.ConnectShapesViaConnector(shapeFromId, ConnectionPointPlace.Right, shapeToId, ConnectionPointPlace.Left, connecter1Id) | |
' Save Visio drawing | |
diagram.Save(dataDir & Convert.ToString("ConnectVisioSubShapes_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load a source Visio | |
Dim srcVisio As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Initialize a new Visio | |
Dim newDiagram As New Diagram() | |
' Add all masters from the source Visio diagram | |
Dim originalMasters As MasterCollection = srcVisio.Masters | |
For Each master As Master In originalMasters | |
newDiagram.AddMaster(srcVisio, master.Name) | |
Next | |
' Get the page object from the original diagram | |
Dim SrcPage As Aspose.Diagram.Page = srcVisio.Pages.GetPage("Page-1") | |
' Copy themes from the source diagram | |
newDiagram.CopyTheme(srcVisio) | |
' Copy pagesheet of the source Visio page | |
newDiagram.Pages(0).PageSheet.Copy(SrcPage.PageSheet) | |
' Copy shapes from the source Visio page | |
For Each shape As Aspose.Diagram.Shape In SrcPage.Shapes | |
newDiagram.Pages(0).Shapes.Add(shape) | |
Next | |
' Save the new Visio | |
newDiagram.Save(dataDir & Convert.ToString("CopyShapes_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get shape by id | |
Dim shape As Shape = diagram.Pages.GetPage("Page-3").Shapes.GetShape(16) | |
' Get connected shapes | |
Dim connectedShapeIds As Long() = shape.ConnectedShapes(ConnectedShapesFlags.ConnectedShapesAllNodes, Nothing) | |
For Each id As Long In connectedShapeIds | |
shape = diagram.Pages.GetPage("Page-3").Shapes.GetShape(id) | |
Console.WriteLine("ID: " & shape.ID & "\t\t Name: " & shape.Name) | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load a Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Initialize an array of shapes | |
Dim ss As Aspose.Diagram.Shape() = New Aspose.Diagram.Shape(2) {} | |
' Extract and assign shapes to the array | |
ss(0) = page.Shapes.GetShape(15) | |
ss(1) = page.Shapes.GetShape(16) | |
ss(2) = page.Shapes.GetShape(17) | |
' Mark array shapes as group | |
page.Shapes.Group(ss) | |
' Save visio diagram | |
diagram.Save(dataDir & Convert.ToString("GroupShapes_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Get shape by id | |
Dim shape As Shape = page.Shapes.GetShape(16) | |
' Move shape from its position, it adds values in coordinates | |
shape.Move(1, 1) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("MoveVisioShape_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
For Each shape As Aspose.Diagram.Shape In page.Shapes | |
If shape.Name = "Process1" Then | |
For Each [property] As Prop In shape.Props | |
Console.WriteLine([property].Label.Value + ": " + [property].Value.Val) | |
Next | |
Exit For | |
End If | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
For Each shape As Aspose.Diagram.Shape In page.Shapes | |
If shape.Name = "Process1" Then | |
Dim [property] As Prop = shape.Props.GetProp("Name1") | |
Console.WriteLine([property].Label.Value + ": " + [property].Value.Val) | |
End If | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Get a particular connector shape | |
Dim shape As Shape = page.Shapes.GetShape(18) | |
' Set reroute option | |
shape.Layout.ConFixedCode.Value = ConFixedCodeValue.NeverReroute | |
' Save Visio diagram | |
diagram.Save(dataDir & Convert.ToString("RerouteConnectors_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load diagram | |
Dim vsdDiagram As New Diagram(dataDir & "RetrieveShapeInfo.vsd") | |
For Each shape As Aspose.Diagram.Shape In vsdDiagram.Pages(0).Shapes | |
' Display information about the shapes | |
Console.WriteLine(Constants.vbLf & "Shape ID : " & shape.ID) | |
Console.WriteLine("Name : " & shape.Name) | |
Console.WriteLine("Master Shape : " & shape.Master.Name) | |
Next shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Get shape by id | |
Dim shape As Shape = page.Shapes.GetShape(16) | |
' Add a shape and set the angle | |
shape.SetAngle(190) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("RotateVisioShape_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim srcVisio As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
Dim shapeWidth As Double = 0 | |
Dim shapeHeight As Double = 0 | |
' Get Visio page | |
Dim srcPage As Aspose.Diagram.Page = srcVisio.Pages.GetPage("Page-3") | |
' Remove background page | |
srcPage.BackPage = Nothing | |
' Get hash table of shapes, it holds id and name | |
Dim remShapes As New Hashtable() | |
' Hashtable<Long, String> remShapes = new Hashtable<Long, String>(); | |
For Each shape As Aspose.Diagram.Shape In srcPage.Shapes | |
' For the normal shape | |
remShapes.Add(shape.ID, shape.Name) | |
Next | |
' Iterate through the hash table | |
For Each shapeEntry As DictionaryEntry In remShapes | |
Dim key As Long = CLng(shapeEntry.Key) | |
Dim val As String = DirectCast(shapeEntry.Value, String) | |
Dim shape As Aspose.Diagram.Shape = srcPage.Shapes.GetShape(key) | |
' Check of the shape name | |
If val.Equals("GroupShape1") Then | |
' Move shape to the origin corner | |
shapeWidth = shape.XForm.Width.Value | |
shapeHeight = shape.XForm.Height.Value | |
shape.MoveTo(shapeWidth * 0.5, shapeHeight * 0.5) | |
' Trim page size | |
srcPage.PageSheet.PageProps.PageWidth.Value = shapeWidth | |
srcPage.PageSheet.PageProps.PageHeight.Value = shapeHeight | |
Else | |
' Remove shape from the Visio page and hash table | |
srcPage.Shapes.Remove(shape) | |
End If | |
Next | |
remShapes.Clear() | |
' Specify saving options | |
Dim opts As New Aspose.Diagram.Saving.PdfSaveOptions() | |
' Set page count to save | |
opts.PageCount = 1 | |
' Set starting index of the page | |
opts.PageIndex = 1 | |
' Save it | |
srcVisio.Save(dataDir & Convert.ToString("SaveVisioShapeInOtherFormats_out.pdf"), opts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSDX diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get a particular page | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Get a dynamic connector type shape by id | |
Dim shape As Shape = page.Shapes.GetShape(18) | |
' Set dynamic connector appearance | |
shape.SetConnectorsType(ConnectorsTypeValue.StraightLines) | |
' Saving Visio diagram | |
diagram.Save(dataDir & Convert.ToString("SetConnectorAppearance_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim vdxDiagram As New Diagram(dataDir & "SetFillData.vsd") | |
' Find a particular shape and update its XForm | |
For Each shape As Aspose.Diagram.Shape In vdxDiagram.Pages(0).Shapes | |
If shape.NameU.ToLower() = "rectangle" AndAlso shape.ID = 1 Then | |
shape.Fill.FillBkgnd.Value = vdxDiagram.Pages(1).Shapes(0).Fill.FillBkgnd.Value | |
shape.Fill.FillForegnd.Value = "#ebf8df" | |
End If | |
Next shape | |
' Save diagram | |
vdxDiagram.Save(dataDir & "SetFillData_out.vsdx", SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load a Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("SetLineData.vsd")) | |
' Get the page by its name | |
Dim page1 As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by its ID | |
Dim shape As Aspose.Diagram.Shape = page1.Shapes.GetShape(1) | |
' Set line dash type by index | |
shape.Line.LinePattern.Value = 4 | |
' Set line weight, defualt in PT | |
shape.Line.LineWeight.Value = 2 | |
' Set color of the shape' S line | |
shape.Line.LineColor.Ufe.F = "RGB(95,108,53)" | |
' Set line rounding, default in inch | |
shape.Line.Rounding.Value = 0.3125 | |
' Set line caps | |
shape.Line.LineCap.Value = BOOL.True | |
' Set line color transparency in percent | |
shape.Line.LineColorTrans.Value = 50 | |
' Add arrows to the connector or curve shapes | |
' Select arrow type by index | |
shape.Line.BeginArrow.Value = 4 | |
shape.Line.EndArrow.Value = 4 | |
' Set arrow size | |
shape.Line.BeginArrowSize.Value = ArrowSizeValue.Large | |
shape.Line.BeginArrowSize.Value = ArrowSizeValue.Large | |
' Save the Visio | |
diagram.Save(dataDir & Convert.ToString("SetLineData_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim vdxDiagram As New Diagram(dataDir & "SetXFormdata.vsd") | |
' Find a particular shape and update its XForm | |
For Each shape As Aspose.Diagram.Shape In vdxDiagram.Pages(0).Shapes | |
If shape.NameU.ToLower() = "process" AndAlso shape.ID = 1 Then | |
shape.XForm.PinX.Value = 5 | |
shape.XForm.PinY.Value = 5 | |
End If | |
Next shape | |
vdxDiagram.Save(dataDir & "SetXFormdata_out.vsdx", SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSD diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Set two shape ids | |
Dim ShapeIdOne As Long = 15 | |
Dim ShapeIdTwo As Long = 16 | |
' Get Visio page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-3") | |
' Get Visio shapes by ids | |
Dim ShapedOne As Shape = page.Shapes.GetShape(ShapeIdOne) | |
Dim ShapedTwo As Shape = page.Shapes.GetShape(ShapeIdTwo) | |
' Determine whether shapes are connected | |
Dim connected As Boolean = ShapedOne.IsConnected(ShapedTwo) | |
Console.WriteLine("Shapes are connected: " & connected) | |
' Determine whether shapes are glued | |
Dim glued As Boolean = ShapedOne.IsGlued(ShapedTwo) | |
Console.WriteLine("Shapes are Glued: " & glued) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call the diagram constructor to load diagram from a VSD file | |
Dim diagram As New Diagram(dataDir & "ExtractAllImagesFromPage.vsd") | |
' Enter page index i.e. 0 for first one | |
For Each shape As Shape In diagram.Pages(0).Shapes | |
' Filter shapes by type Foreign | |
If shape.Type = Aspose.Diagram.TypeValue.Foreign Then | |
Using stream As New System.IO.MemoryStream(shape.ForeignData.Value) | |
' Load memory stream into bitmap object | |
Dim bitmap As New System.Drawing.Bitmap(stream) | |
' Save bmp here | |
bitmap.Save(dataDir & "ExtractAllImages" & shape.ID & ".bmp") | |
End Using | |
End If | |
Next shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load stencil file to a diagram object | |
Dim stencil As New Diagram(dataDir & Convert.ToString("Timeline.vss")) | |
' Get master | |
Dim master As Master = stencil.Masters.GetMaster(1) | |
Using stream As New System.IO.MemoryStream(master.Icon) | |
' Load memory stream into bitmap object | |
Dim bitmap As New System.Drawing.Bitmap(stream) | |
' Save as png format | |
bitmap.Save(dataDir & Convert.ToString("MasterIcon_out.png"), System.Drawing.Imaging.ImageFormat.Png) | |
End Using |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Create a new diagram | |
Dim diagram As New Diagram() | |
' Get page object by index | |
Dim page0 As Page = diagram.Pages(0) | |
' Set pinX, pinY, width and height | |
Dim pinX As Double = 2, pinY As Double = 2, width As Double = 4, hieght As Double = 3 | |
' Import Bitmap image as Visio shape | |
page0.AddShape(pinX, pinY, width, hieght, New FileStream(dataDir & Convert.ToString("image.bmp"), FileMode.OpenOrCreate)) | |
' Save Visio diagram | |
diagram.Save(dataDir & Convert.ToString("InsertImageInVisio_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSD diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("ExtractAllImagesFromPage.vsd")) | |
' Convert image into bytes array | |
Dim imageBytes As Byte() = File.ReadAllBytes(dataDir & Convert.ToString("Picture.png")) | |
' Enter page index i.e. 0 for first one | |
For Each shape As Shape In diagram.Pages(0).Shapes | |
' Filter shapes by type Foreign | |
If shape.Type = Aspose.Diagram.TypeValue.Foreign Then | |
Using stream As New System.IO.MemoryStream(shape.ForeignData.Value) | |
'replace picture shape | |
shape.ForeignData.Value = imageBytes | |
End Using | |
End If | |
Next | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("ReplaceShapePicture_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Call a Diagram class constructor to load the VSD diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("RetrieveShapeInfo.vsd")) | |
' Get shape by an ID | |
Dim shape As Shape = diagram.Pages(0).Shapes.GetShape(90) | |
' Get all glued 1D shapes | |
Dim gluedShapeIds As Long() = shape.GluedShapes(GluedShapesFlags.GluedShapesAll1D, Nothing, Nothing) | |
' Display shape ID and name | |
For Each id As Long In gluedShapeIds | |
shape = diagram.Pages(0).Shapes.GetShape(id) | |
Console.WriteLine("ID: " & shape.ID & "\t\t Name: " & shape.Name) | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get a particular page | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' The ID of shape which is glue from Aspose.Diagram.Shape. | |
Dim shapeFromId As Long = 779 | |
' The location on the first connection index where to glue | |
Dim shapeToBeginConnectionIndex As Integer = 72 | |
' The location on the end connection index where to glue | |
Dim shapeToEndConnectionIndex As Integer = 73 | |
' The ID of shape where to glue to Aspose.Diagram.Shape. | |
Dim shapeToId As Long = 743 | |
' Glue shapes in container | |
page.GlueShapesInContainer(shapeFromId, shapeToBeginConnectionIndex, shapeToEndConnectionIndex, shapeToId) | |
' Glue shapes in container using connection name | |
' Page.GlueShapesInContainer(fasId, "U05L", "U05R", cabinetId1); | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("GlueContainerShape_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Shapes() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get a particular page | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Set shape id | |
Dim shape1_ID As Long = 7 | |
Dim shape2_ID As Long = 494 | |
' Glue shapes | |
page.GlueShapes(shape1_ID, Aspose.Diagram.Manipulation.ConnectionPointPlace.Center, shape2_ID) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("GlueVisioShapes_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioComments() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Add comment | |
diagram.Pages(0).AddComment(7.20590551181102, 3.88070866141732, "test@") | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("AddComment_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioComments() | |
' Load Visio | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get collection of the annotations | |
Dim annotations As AnnotationCollection = diagram.Pages.GetPage("Page-1").PageSheet.Annotations | |
' Iterate through the annotations | |
For Each annotation As Annotation In annotations | |
Dim comment As String = annotation.Comment.Value | |
comment += "Updation mark" | |
annotation.Comment.Value = comment | |
Next | |
' Save Visio | |
diagram.Save(dataDir & Convert.ToString("EditComment_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ExternalDataSources() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsd")) | |
' Set connecting string | |
diagram.DataConnections(0).ConnectionString = "Data Source=MyServer;Initial Catalog=MyDB;Integrated Security=True" | |
' Set command | |
diagram.DataConnections(0).Command = "SELECT * from Project with(nolock)" | |
' Refresh all record sets | |
diagram.Refresh() | |
' Save Visio diagram | |
diagram.Save(dataDir & Convert.ToString("EditDataConAndRefreshRecords_out.vdx"), SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_GeometrySection() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Set connector shape by page name and ID | |
Dim connectorId As Long = 4 | |
Dim connector As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(connectorId) | |
' Get connector geometry at index 0 | |
Dim defaultLineTo As LineTo = connector.Geoms(0).CoordinateCol.LineToCol(0) | |
'remove connector geometry from index 0 | |
connector.Geoms(0).CoordinateCol.LineToCol(0).Del = BOOL.True | |
' Initialize LineTo geometry object | |
Dim lineTo As New LineTo() | |
' Set X value | |
lineTo.X.Value = 0 | |
' Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value / 2 | |
' Add connector geometry | |
connector.Geoms(0).CoordinateCol.Add(lineTo) | |
' Initialize LineTo geometry object | |
lineTo = New LineTo() | |
' Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value / 2 | |
' Set X value | |
lineTo.X.Value = defaultLineTo.X.Value | |
' Add connector geometry | |
connector.Geoms(0).CoordinateCol.Add(lineTo) | |
' Initialize LineTo geometry object | |
lineTo = New LineTo() | |
' Set X value | |
lineTo.X.Value = defaultLineTo.X.Value | |
' Set Y value | |
lineTo.Y.Value = defaultLineTo.Y.Value | |
' Add connector geometry | |
connector.Geoms(0).CoordinateCol.Add(lineTo) | |
' Save diagram in VDX format | |
diagram.Save(dataDir & Convert.ToString("EditConnectorGeometry_out.vsdx"), SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Hyperlinks() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(2) | |
' Initialize Hyperlink object | |
Dim hyperlink As New Hyperlink() | |
' Set address value | |
hyperlink.Address.Value = "http://www.google.com/" | |
' Set sub address value | |
hyperlink.SubAddress.Value = "Sub address here" | |
' Set description value | |
hyperlink.Description.Value = "Description here" | |
' Set name | |
hyperlink.Name = "MyHyperLink" | |
' Add hyperlink to the shape | |
shape.Hyperlinks.Add(hyperlink) | |
' Save diagram to local space | |
diagram.Save(dataDir & Convert.ToString("AddHyperlinkToShape_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Hyperlinks() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(1) | |
' Iterate through the hyperlinks | |
For Each hyperlink As Aspose.Diagram.Hyperlink In shape.Hyperlinks | |
Console.WriteLine("Address: " + hyperlink.Address.Value) | |
Console.WriteLine("Sub Address: " + hyperlink.SubAddress.Value) | |
Console.WriteLine("Description: " + hyperlink.Description.Value) | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Layers() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get Visio page | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' Initialize a new Layer class object | |
Dim layer As New Layer() | |
' Set Layer name | |
layer.Name.Value = "Layer1" | |
' Set Layer Visibility | |
layer.Visible.Value = BOOL.True | |
' Set the color checkbox of Layer | |
layer.IsColorChecked = BOOL.True | |
' Add Layer to the particular page sheet | |
page.PageSheet.Layers.Add(layer) | |
' Get shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(3) | |
' Assign shape to this new Layer | |
shape.LayerMem.LayerMember.Value = layer.IX.ToString() | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("AddLayer_out.vsdx"), SaveFileFormat.VSDX) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Layers() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Iterate through the shapes | |
For Each shape As Aspose.Diagram.Shape In page.Shapes | |
If shape.Name.ToLower() = "shape1" Then | |
' Add shape1 in first two layers. Here "0;1" are indexes of the layers | |
Dim layer As LayerMem = shape.LayerMem | |
layer.LayerMember.Value = "0;1" | |
ElseIf shape.Name.ToLower() = "shape2" Then | |
'Remove shape2 from all the layers | |
Dim layer As LayerMem = shape.LayerMem | |
layer.LayerMember.Value = "" | |
ElseIf shape.Name.ToLower() = "shape3" Then | |
' Add shape3 in first layer. Here "0" is index of the first layer | |
Dim layer As LayerMem = shape.LayerMem | |
layer.LayerMember.Value = "0" | |
End If | |
Next | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("ConfigureShapeLayers_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Layers() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get Visio page | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' Iterate through the layers | |
For Each layer As Layer In page.PageSheet.Layers | |
Console.WriteLine("Name: " & layer.Name.Value) | |
Console.WriteLine("Visibility: " & layer.Visible.Value) | |
Console.WriteLine("Status: " & layer.Status.Value) | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Master() | |
' Load diagram | |
Dim diagram As New Diagram() | |
' Load stencil to a stream | |
Dim templateFileName As String = dataDir & Convert.ToString("NetApp-FAS-series.vss") | |
Dim stream As Stream = New FileStream(templateFileName, FileMode.Open) | |
' Add master with stencil file path and master id | |
Dim masterName As String = "FAS80xx rear empty" | |
diagram.AddMaster(templateFileName, 2) | |
' Add master with stencil file path and master name | |
diagram.AddMaster(templateFileName, masterName) | |
' Add master with stencil file stream and master id | |
diagram.AddMaster(stream, 2) | |
' Adds master to diagram from source diagram | |
Dim src As New Diagram(templateFileName) | |
diagram.AddMaster(src, masterName) | |
' Add master with stencil file stream and master id | |
diagram.AddMaster(stream, masterName) | |
' Adds shape with defined PinX and PinY. | |
diagram.AddShape(2.0, 2.0, masterName, 0) | |
diagram.AddShape(6.0, 6.0, masterName, 0) | |
' Adds shape with defined PinX,PinY,Width and Height. | |
diagram.AddShape(7.0, 3.0, 1.5, 1.5, masterName, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Master() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Basic Shapes.vss")) | |
' Set master id | |
Dim masterid As Integer = 2 | |
' Check master by id | |
Dim isPresent As Boolean = diagram.Masters.IsExist(2) | |
Console.WriteLine("Master Presence : " & isPresent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Master() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Basic Shapes.vss")) | |
' Set master name | |
Dim masterName As String = "VNXe3100 Storage Processor Rear" | |
' Check master object by name | |
Dim isPresent As Boolean = diagram.Masters.IsExist(masterName) | |
Console.WriteLine("Master Presence : " & isPresent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Master() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("RetrieveMasterInfo.vdx")) | |
' Set master id | |
Dim masterid As Integer = 2 | |
' Get master object by id | |
Dim master As Master = diagram.Masters.GetMaster(masterid) | |
Console.WriteLine("Master ID : " & master.ID) | |
Console.WriteLine("Master Name : " & master.Name) | |
Console.WriteLine("Master Name : " & master.UniqueID.ToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Master() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Basic Shapes.vss")) | |
' Set master name | |
Dim masterName As String = "Circle" | |
' Get master object by name | |
Dim master As Master = diagram.Masters.GetMasterByName(masterName) | |
Console.WriteLine("Master ID : " & master.ID) | |
Console.WriteLine("Master Name : " & master.Name) | |
Console.WriteLine("Master Name : " & master.UniqueID.ToString()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Master() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim vdxDiagram As New Diagram(dataDir & "RetrieveMasterInfo.vdx") | |
For Each master As Aspose.Diagram.Master In vdxDiagram.Masters | |
' Display information about the masters | |
Console.WriteLine(Constants.vbLf & "Master ID : " & master.ID) | |
Console.WriteLine("Master Name : " & master.Name) | |
Next master | |
Console.ReadLine() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioPages() | |
' Initialize the new visio diagram | |
Dim NewDigram As New Diagram() | |
' Load source diagram | |
Dim dgm As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Add all masters from the source Visio diagram | |
For Each master As Master In dgm.Masters | |
NewDigram.Masters.Add(master) | |
Next | |
' Get page object | |
Dim SrcPage As Aspose.Diagram.Page = dgm.Pages.GetPage("Page-1") | |
' Set name | |
SrcPage.Name = "new page" | |
' It calculates max page id | |
Dim max As Integer = 0 | |
If NewDigram.Pages.Count <> 0 Then | |
max = NewDigram.Pages(0).ID | |
End If | |
For i As Integer = 1 To NewDigram.Pages.Count - 1 | |
If max < NewDigram.Pages(i).ID Then | |
max = NewDigram.Pages(i).ID | |
End If | |
Next | |
' Set max page ID | |
Dim MaxPageId As Integer = max | |
' Set page ID | |
SrcPage.ID = MaxPageId + 1 | |
' Add page from the source diagram | |
NewDigram.Pages.Add(SrcPage) | |
' Remove first empty page | |
NewDigram.Pages.Remove(NewDigram.Pages(0)) | |
' Save diagram | |
NewDigram.Save(dataDir & Convert.ToString("CopyVisioPage_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioPages() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Set page id | |
Dim pageid As Integer = 2 | |
' Get page object by id | |
Dim page2 As Page = diagram.Pages.GetPage(pageid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioPages() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Set page name | |
Dim pageName As String = "Flow 2" | |
' Get page object by name | |
Dim page2 As Page = diagram.Pages.GetPage(pageName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioPages() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' It calculates max page id | |
Dim max As Integer = 0 | |
If diagram.Pages.Count <> 0 Then | |
max = diagram.Pages(0).ID | |
End If | |
For i As Integer = 1 To diagram.Pages.Count - 1 | |
If max < diagram.Pages(i).ID Then | |
max = diagram.Pages(i).ID | |
End If | |
Next | |
' Set max page ID | |
Dim MaxPageId As Integer = max | |
' Initialize a new page object | |
Dim newPage As New Page() | |
' Set name | |
newPage.Name = "new page" | |
' Set page ID | |
newPage.ID = MaxPageId + 1 | |
' Or try the Page constructor | |
' Page newPage = new Page(MaxPageId + 1); | |
' Add a new blank page | |
diagram.Pages.Add(newPage) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("InsertBlankPage_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioPages() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim vdxDiagram As New Diagram(dataDir & "RetrievePageInfo.vdx") | |
For Each page As Aspose.Diagram.Page In vdxDiagram.Pages | |
' Checks if current page is a background page | |
If page.Background = Aspose.Diagram.BOOL.True Then | |
' Display information about the background page | |
Console.WriteLine("Background Page ID : " & page.ID) | |
Console.WriteLine("Background Page Name : " & page.Name) | |
Else | |
' Display information about the foreground page | |
Console.WriteLine(Constants.vbLf & "Page ID : " & page.ID) | |
Console.WriteLine("Universal Name : " & page.NameU) | |
Console.WriteLine("ID of the Background Page : " & page.BackPage.ToString()) | |
End If | |
Next page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_VisioPages() | |
' Initialize the new visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get Visio page | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage("Flow 1") | |
' Page orientation | |
page.PageSheet.PrintProps.PrintPageOrientation.Value = PrintPageOrientationValue.Landscape | |
' Save Visio | |
diagram.Save(dataDir & Convert.ToString("SetPageOrientation_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Print() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Call the print method to print whole Diagram using the default printer | |
diagram.Print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Print() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Call the print method to print whole Diagram using the printer name | |
diagram.Print("LaserJet1100") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Print() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Specify the name of the printer you want to print to. | |
Const printerName As String = "\\COMPANY\Brother MFC-885CW Printer" | |
' Print the document. | |
XpsPrintHelper.Print(diagram, printerName, "My Test Job", True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Print() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Call the print method to print whole Diagram using the printer name and set document name in the print job | |
diagram.Print("LaserJet1100", "Job name while printing with Aspose.Diagram") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
''' <summary> | |
''' Sends an Aspose.Diagram document to a printer using the XpsPrint API. | |
''' </summary> | |
''' <param name="diagram"></param> | |
''' <param name="printerName"></param> | |
''' <param name="jobName">Job name. Can be null.</param> | |
''' <param name="isWait">True to wait for the job to complete. False to return immediately after submitting the job.</param> | |
''' <exception cref="Exception">Thrown if any error occurs.</exception> | |
Public Shared Sub Print(diagram As Diagram, printerName As String, jobName As String, isWait As Boolean) | |
If diagram Is Nothing Then | |
Throw New ArgumentNullException("document") | |
End If | |
' Use Aspose.Diagram to convert the document to XPS and store in a memory stream. | |
Dim stream As New MemoryStream() | |
diagram.Save(stream, SaveFileFormat.XPS) | |
stream.Position = 0 | |
Print(stream, printerName, jobName, isWait) | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
''' <summary> | |
''' Sends a stream that contains a document in the XPS format to a printer using the XpsPrint API. | |
''' Has no dependency on Aspose.Diagram, can be used in any project. | |
''' </summary> | |
''' <param name="stream"></param> | |
''' <param name="printerName"></param> | |
''' <param name="jobName">Job name. Can be null.</param> | |
''' <param name="isWait">True to wait for the job to complete. False to return immediately after submitting the job.</param> | |
''' <exception cref="Exception">Thrown if any error occurs.</exception> | |
Public Shared Sub Print(stream As Stream, printerName As String, jobName As String, isWait As Boolean) | |
If stream Is Nothing Then | |
Throw New ArgumentNullException("stream") | |
End If | |
If printerName Is Nothing Then | |
Throw New ArgumentNullException("printerName") | |
End If | |
' Create an event that we will wait on until the job is complete. | |
Dim completionEvent As IntPtr = CreateEvent(IntPtr.Zero, True, False, Nothing) | |
If completionEvent = IntPtr.Zero Then | |
Throw New Win32Exception() | |
End If | |
Try | |
Dim job As IXpsPrintJob | |
Dim jobStream As IXpsPrintJobStream | |
job = Nothing | |
jobStream = Nothing | |
StartJob(printerName, jobName, completionEvent, job, jobStream) | |
CopyJob(stream, job, jobStream) | |
If isWait Then | |
WaitForJob(completionEvent) | |
CheckJobStatus(job) | |
End If | |
Finally | |
If completionEvent <> IntPtr.Zero Then | |
CloseHandle(completionEvent) | |
End If | |
End Try | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Protection() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & "ProtectAndUnprotect.vsd") | |
diagram.DocumentSettings.ProtectBkgnds = BOOL.True | |
diagram.DocumentSettings.ProtectMasters = BOOL.True | |
diagram.DocumentSettings.ProtectShapes = BOOL.True | |
diagram.DocumentSettings.ProtectStyles = BOOL.True | |
' Save diagram | |
diagram.Save(dataDir & "VisioDiagramProtection_out.vdx", SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_Protection() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("ProtectAndUnprotect.vsd")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Flow 1") | |
' Get shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(1) | |
' Set protections | |
shape.Protection.LockAspect.Value = BOOL.True | |
shape.Protection.LockBegin.Value = BOOL.True | |
shape.Protection.LockCalcWH.Value = BOOL.True | |
shape.Protection.LockCrop.Value = BOOL.True | |
shape.Protection.LockCustProp.Value = BOOL.True | |
shape.Protection.LockDelete.Value = BOOL.True | |
shape.Protection.LockEnd.Value = BOOL.True | |
shape.Protection.LockFormat.Value = BOOL.True | |
shape.Protection.LockFromGroupFormat.Value = BOOL.True | |
shape.Protection.LockGroup.Value = BOOL.True | |
shape.Protection.LockHeight.Value = BOOL.True | |
shape.Protection.LockMoveX.Value = BOOL.True | |
shape.Protection.LockMoveY.Value = BOOL.True | |
shape.Protection.LockRotate.Value = BOOL.True | |
shape.Protection.LockSelect.Value = BOOL.True | |
shape.Protection.LockTextEdit.Value = BOOL.True | |
shape.Protection.LockThemeColors.Value = BOOL.True | |
shape.Protection.LockThemeEffects.Value = BOOL.True | |
shape.Protection.LockVtxEdit.Value = BOOL.True | |
shape.Protection.LockWidth.Value = BOOL.True | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("VisioShapeProtection_out.vdx"), SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_SolutionXML() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Initialize SolutionXML object | |
Dim solXML As New SolutionXML() | |
' Set name | |
solXML.Name = "Solution XML" | |
' Set xml value | |
solXML.XmlValue = "XML Value" | |
' Add SolutionXML element | |
diagram.SolutionXMLs.Add(solXML) | |
' Save Visio diagram | |
diagram.Save(dataDir & Convert.ToString("AddSolutionXMLElement_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_SolutionXML() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Iterate through SolutionXML elements | |
For Each solutionXML As SolutionXML In diagram.SolutionXMLs | |
' Get name property | |
Console.WriteLine(solutionXML.Name) | |
' Get xml value | |
Console.WriteLine(solutionXML.XmlValue) | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeText() | |
' Load diagram | |
Dim vsdDiagram As New Diagram(dataDir & "ApplyCustomStyleSheets.vsd") | |
Dim sourceShape As Shape = Nothing | |
' Find the shape that you want to apply style to | |
For Each shape As Aspose.Diagram.Shape In vsdDiagram.Pages(0).Shapes | |
If shape.Name = "Process" Then | |
sourceShape = shape | |
Exit For | |
End If | |
Next shape | |
Dim customStyleSheet As StyleSheet = Nothing | |
' Find the required style sheet | |
For Each styleSheet As StyleSheet In vsdDiagram.StyleSheets | |
If styleSheet.Name = "Basic" Then | |
customStyleSheet = styleSheet | |
Exit For | |
End If | |
Next styleSheet | |
If sourceShape IsNot Nothing AndAlso customStyleSheet IsNot Nothing Then | |
' Apply text style | |
sourceShape.TextStyle = customStyleSheet | |
' Apply fill style | |
sourceShape.FillStyle = customStyleSheet | |
' Apply line style | |
sourceShape.LineStyle = customStyleSheet | |
End If | |
' Save changed diagram as VDX | |
vsdDiagram.Save(dataDir & "ApplyCustomStyleSheets_out.vdx", SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeText() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by ID | |
Dim shape As Shape = page.Shapes.GetShape(1) | |
' Clear shape text values and chars | |
shape.Text.Value.Clear() | |
shape.Chars.Clear() | |
' Mark character run and add text | |
shape.Text.Value.Add(New Cp(0)) | |
shape.Text.Value.Add(New Txt("TextStyle_Regular\n")) | |
shape.Text.Value.Add(New Cp(1)) | |
shape.Text.Value.Add(New Txt("TextStyle_Bold_Italic\n")) | |
shape.Text.Value.Add(New Cp(2)) | |
shape.Text.Value.Add(New Txt("TextStyle_Underline_Italic\n")) | |
shape.Text.Value.Add(New Cp(3)) | |
shape.Text.Value.Add(New Txt("TextStyle_Bold_Italic_Underline")) | |
' Add formatting characters | |
shape.Chars.Add(New Aspose.Diagram.Char()) | |
shape.Chars.Add(New Aspose.Diagram.Char()) | |
shape.Chars.Add(New Aspose.Diagram.Char()) | |
shape.Chars.Add(New Aspose.Diagram.Char()) | |
' Set properties e.g. color, font, size and style etc. | |
shape.Chars(0).IX = 0 | |
shape.Chars(0).Color.Value = "#FF0000" | |
shape.Chars(0).Font.Value = 4 | |
shape.Chars(0).Size.Value = 0.22 | |
shape.Chars(0).Style.Value = StyleValue.Undefined | |
' Set properties e.g. color, font, size and style etc. | |
shape.Chars(1).IX = 1 | |
shape.Chars(1).Color.Value = "#FF00FF" | |
shape.Chars(1).Font.Value = 4 | |
shape.Chars(1).Size.Value = 0.22 | |
shape.Chars(1).Style.Value = StyleValue.Bold Or StyleValue.Italic | |
' Set properties e.g. color, font, size and style etc. | |
shape.Chars(2).IX = 2 | |
shape.Chars(2).Color.Value = "#00FF00" | |
shape.Chars(2).Font.Value = 4 | |
shape.Chars(2).Size.Value = 0.22 | |
shape.Chars(2).Style.Value = StyleValue.Underline Or StyleValue.Italic | |
' Set properties e.g. color, font, size and style etc. | |
shape.Chars(3).IX = 3 | |
shape.Chars(3).Color.Value = "#3333FF" | |
shape.Chars(3).Font.Value = 4 | |
shape.Chars(3).Size.Value = 0.22 | |
shape.Chars(3).Style.Value = StyleValue.Bold Or StyleValue.Italic Or StyleValue.Underline | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("ApplyFontOnText_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeTextBoxData() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get the page by its name | |
Dim page1 As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by its ID | |
Dim shape As Aspose.Diagram.Shape = page1.Shapes.GetShape(1) | |
' Set orientation angle | |
Dim margin As New DoubleValue(4, MeasureConst.PT) | |
' Set left, right, top and bottom margins of the shape' S text block | |
shape.TextBlock.LeftMargin = margin | |
shape.TextBlock.RightMargin = margin | |
shape.TextBlock.TopMargin = margin | |
shape.TextBlock.BottomMargin = margin | |
' Set the text direction | |
shape.TextBlock.TextDirection.Value = TextDirectionValue.Vertical | |
' Set the text alignment | |
shape.TextBlock.VerticalAlign.Value = VerticalAlignValue.Middle | |
' Set the text block background color | |
shape.TextBlock.TextBkgnd.Ufe.F = "RGB(95,108,53)" | |
' Set the background color transparency in percent | |
shape.TextBlock.TextBkgndTrans.Value = 50 | |
' Set the distance between default tab stops for the selected shape. | |
shape.TextBlock.DefaultTabStop.Value = 2 | |
' Save Visio | |
diagram.Save(dataDir & Convert.ToString("FormatShapeTextBlockSection_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeTextBoxData() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get shape | |
Dim shapeid As Long = 1 | |
Dim shape As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Set text position at the bottom, | |
' TxtLocPinY = "TxtHeight*1" and TxtPinY = "Height*0" | |
shape.TextXForm.TxtLocPinY.Value = shape.TextXForm.TxtHeight.Value | |
shape.TextXForm.TxtPinY.Value = 0 | |
' Set orientation angle | |
Dim angleDeg As Double = 0 | |
Dim angleRad As Double = (Math.PI / 180) * angleDeg | |
shape.TextXForm.TxtAngle.Value = angleRad | |
' Save Visio diagram in the local storage | |
diagram.Save(dataDir & Convert.ToString("SetShapeTextPositionAtBottom_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeTextBoxData() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get shape | |
Dim shapeid As Long = 1 | |
Dim shape As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Set text position at the left, | |
' TxtLocPinX = "TxtWidth*1" and TxtPinX = "Width*0" | |
shape.TextXForm.TxtLocPinX.Value = shape.TextXForm.TxtWidth.Value | |
shape.TextXForm.TxtPinX.Value = 0 | |
' Set orientation angle | |
Dim angleDeg As Double = 0 | |
Dim angleRad As Double = (Math.PI / 180) * angleDeg | |
shape.TextXForm.TxtAngle.Value = angleRad | |
' Save Visio diagram in the local storage | |
diagram.Save(dataDir & Convert.ToString("SetShapeTextPositionAtLeft_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeTextBoxData() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get shape | |
Dim shapeid As Long = 1 | |
Dim shape As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Set text position at the right, | |
' TxtLocPinX = "TxtWidth*0" and TxtPinX = "Width*1" | |
shape.TextXForm.TxtLocPinX.Value = 0 | |
shape.TextXForm.TxtPinX.Value = shape.XForm.Width.Value | |
' Set orientation angle | |
Dim angleDeg As Double = 0 | |
Dim angleRad As Double = (Math.PI / 180) * angleDeg | |
shape.TextXForm.TxtAngle.Value = angleRad | |
' Save Visio diagram in the local storage | |
diagram.Save(dataDir & Convert.ToString("SetShapeTextPositionAtRight_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeTextBoxData() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get shape | |
Dim shapeid As Long = 1 | |
Dim shape As Shape = diagram.Pages.GetPage("Page-1").Shapes.GetShape(shapeid) | |
' Set text position at the top, | |
' TxtLocPinY = "TxtHeight*0" and TxtPinY = "Height*1" | |
shape.TextXForm.TxtLocPinY.Value = 0 | |
shape.TextXForm.TxtPinY.Value = shape.XForm.Height.Value | |
' Set orientation angle | |
Dim angleDeg As Double = 0 | |
Dim angleRad As Double = (Math.PI / 180) * angleDeg | |
shape.TextXForm.TxtAngle.Value = angleRad | |
' Save Visio diagram in the local storage | |
diagram.Save(dataDir & Convert.ToString("SetShapeTextPositionAtTop_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeText() | |
' Prepare a collection old and new text | |
Dim replacements As New Dictionary(Of String, String)() | |
replacements.Add("[[CompanyName]]", "Research Society of XYZ") | |
replacements.Add("[[EmployeeName]]", "James Bond") | |
replacements.Add("[[SubjectTitle]]", "The affect of the internet on social behavior in the industrialize world") | |
replacements.Add("[[TimePeriod]]", DateTime.Now.AddYears(-1).ToString("dd/MMMM/yyyy") + " -- " + DateTime.Now.ToString("dd/MMMM/yyyy")) | |
replacements.Add("[[SubmissionDate]]", DateTime.Now.AddDays(-7).ToString("dd/MMMM/yyyy")) | |
replacements.Add("[[AmountReq]]", "$100,000") | |
replacements.Add("[[DateApproved]]", DateTime.Now.AddDays(1).ToString("dd/MMMM/yyyy")) | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("FindReplaceText.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Iterate through the shapes of a page | |
For Each shape As Shape In page.Shapes | |
For Each kvp As KeyValuePair(Of String, String) In replacements | |
For Each txt As FormatTxt In shape.Text.Value | |
Dim tx As Txt = TryCast(txt, Txt) | |
If tx IsNot Nothing AndAlso tx.Text.Contains(kvp.Key) Then | |
' Find and replace text of a shape | |
tx.Text = tx.Text.Replace(kvp.Key, kvp.Value) | |
End If | |
Next | |
Next | |
Next | |
' Save the diagram | |
diagram.Save(dataDir & Convert.ToString("FindAndReplaceShapeText_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
Shared text As String = "" | |
Public Shared Sub Run() | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeText() | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get Visio diagram page | |
Dim page As Aspose.Diagram.Page = diagram.Pages.GetPage("Page-1") | |
' Iterate through the shapes | |
For Each shape As Aspose.Diagram.Shape In page.Shapes | |
' Extract plain text from the shape | |
GetShapeText(shape) | |
Next | |
' Display extracted text | |
Console.WriteLine(text) | |
End Sub | |
Private Shared Sub GetShapeText(shape As Aspose.Diagram.Shape) | |
' Filter shape text | |
If shape.Text.Value.Text <> "" Then | |
text += Regex.Replace(shape.Text.Value.Text, "\<.*?>", "") | |
End If | |
' For image shapes | |
If shape.Type = TypeValue.Foreign Then | |
text += (shape.Name) | |
End If | |
' For group shapes | |
If shape.Type = TypeValue.Group Then | |
For Each subshape As Aspose.Diagram.Shape In shape.Shapes | |
GetShapeText(subshape) | |
Next | |
End If | |
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeText() | |
' Create a new diagram | |
Dim diagram As New Diagram() | |
' Set parameters and add text to a Visio page | |
Dim PinX As Double = 1, PinY As Double = 1, Width As Double = 1, Height As Double = 1 | |
diagram.Pages(0).AddText(PinX, PinY, Width, Height, "Test text") | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("InsertTextShape_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_ShapeText() | |
' Call the diagram constructor to load diagram from a VDX file | |
Dim vdxDiagram As New Diagram(dataDir & "UpdateShapeText.vsd") | |
' Find a particular shape and update its text | |
For Each shape As Aspose.Diagram.Shape In vdxDiagram.Pages(0).Shapes | |
If shape.NameU.ToLower() = "process" AndAlso shape.ID = 1 Then | |
shape.Text.Value.Clear() | |
shape.Text.Value.Add(New Txt("New Text")) | |
End If | |
Next shape | |
' Save diagram | |
vdxDiagram.Save(dataDir & "UpdateShapeText_out.vdx", SaveFileFormat.VDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_UserDefinedCells() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by id | |
Dim shape As Shape = page.Shapes.GetShape(2) | |
' Initialize user object | |
Dim user As New User() | |
user.Name = "UserDefineCell" | |
user.Value.Val = "800" | |
' Add user-defined cell | |
shape.Users.Add(user) | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("CreateUserDefinedCellInShapeSheet_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_UserDefinedCells() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get page by name | |
Dim page As Page = diagram.Pages.GetPage("Page-1") | |
' Get shape by id | |
Dim shape As Shape = page.Shapes.GetShape(1) | |
' Extract user defined cells of the shape | |
For Each user As User In shape.Users | |
Console.WriteLine(user.Name + ": " + user.Value.Val) | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_UserDefinedCells() | |
Dim count As Integer = 0 | |
' Load diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Iterate through pages | |
For Each objPage As Aspose.Diagram.Page In diagram.Pages | |
' Iterate through shapes | |
For Each objShape As Aspose.Diagram.Shape In objPage.Shapes | |
Console.WriteLine(objShape.NameU) | |
' Iterate through user-defined cells | |
For Each objUserField As Aspose.Diagram.User In objShape.Users | |
count += 1 | |
Console.WriteLine(count.ToString() + " - Name: " + objUserField.NameU + " Value: " + objUserField.Value.Val + " Prompt: " + objUserField.Prompt.Value) | |
Next | |
Next | |
Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_WindowElements() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get window object by index | |
Dim window As Window = diagram.Windows(0) | |
' Check dynamic grid option | |
window.DynamicGridEnabled = BOOL.True | |
' Check connection points option | |
window.ShowConnectionPoints = BOOL.True | |
' Save visio drawing | |
diagram.Save(dataDir & Convert.ToString("AddSupportOfVisualAids_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_WindowElements() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Initialize window object | |
Dim window As New Window() | |
' Set window state | |
window.WindowState = WindowStateValue.Maximized | |
' Set window height | |
window.WindowHeight = 500 | |
' Set window width | |
window.WindowWidth = 500 | |
' Set window type | |
window.WindowType = WindowTypeValue.Stencil | |
' Add window object | |
diagram.Windows.Add(window) | |
' Save in any supported format | |
diagram.Save(dataDir & Convert.ToString("AddWindowElementInVisio_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_WindowElements() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Get window object by index | |
Dim window As Window = diagram.Windows(0) | |
' Set visibility of grid | |
window.ShowGrid = BOOL.True | |
' Set visibility of guides | |
window.ShowGuides = BOOL.True | |
' Set visibility of rulers | |
window.ShowRulers = BOOL.True | |
' Set visibility of page breaks | |
window.ShowPageBreaks = BOOL.True | |
' Save diagram | |
diagram.Save(dataDir & Convert.ToString("DisplayGridsRulersGuidesAndPageBreaks_out.vsdx"), SaveFileFormat.VSDX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-.NET | |
' The path to the documents directory. | |
Dim dataDir As String = RunExamples.GetDataDir_WindowElements() | |
' Load source Visio diagram | |
Dim diagram As New Diagram(dataDir & Convert.ToString("Drawing1.vsdx")) | |
' Iterate through the window elements | |
For Each window As Window In diagram.Windows | |
Console.WriteLine("ID: " & window.ID) | |
Console.WriteLine("Type: " & window.WindowType) | |
Console.WriteLine("Window height: " & window.WindowHeight) | |
Console.WriteLine("Window width: " & window.WindowWidth) | |
Console.WriteLine("Window state: " & window.WindowState) | |
Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment