|
| 1 | +--- |
| 2 | +id: load-diagram-document-with-options |
| 3 | +url: conversion/net/load-diagram-document-with-options |
| 4 | +title: Load diagram document with options |
| 5 | +weight: 21 |
| 6 | +description: "Learn how to load and convert diagram files (VSD, VSDX, Visio) with advanced options using GroupDocs.Conversion for .NET API." |
| 7 | +keywords: Load diagram file, Load and convert VSD, Load and convert VSDX, Load and convert Visio, Diagram file conversion |
| 8 | +productName: GroupDocs.Conversion for .NET |
| 9 | +hideChildren: False |
| 10 | +toc: True |
| 11 | +--- |
| 12 | +[**GroupDocs.Conversion**](https://products.groupdocs.com/conversion/net) provides [DiagramLoadOptions](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/diagramloadoptions) to control how source diagram files are processed. Diagram files include formats like VSD, VSDX, VDX, VSDM, VSSX, and other Microsoft Visio formats. |
| 13 | + |
| 14 | +The following options are available: |
| 15 | + |
| 16 | +| Option | Description | |
| 17 | +|--------|-------------| |
| 18 | +|**[Format](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/diagramloadoptions/format)** | The document type is auto-detected during loading, but you can explicitly specify the source format. Available options include: *Vsd, Vsdx, Vsx, Vtx, Vdx, Vssx, Vstx, Vsdm, Vssm, Vstm* | |
| 19 | +|**[DefaultFont](https://reference.groupdocs.com/conversion/net/groupdocs.conversion.options.load/diagramloadoptions/defaultfont)** | Default font for rendering the diagram. The following font will be used if a diagram font is missing. | |
| 20 | + |
| 21 | +## Load VSD file |
| 22 | + |
| 23 | +The following code snippet shows how to load a VSD (Visio Drawing) file with explicit format specification: |
| 24 | + |
| 25 | +With v24.10 and later: |
| 26 | + |
| 27 | +```csharp |
| 28 | +using GroupDocs.Conversion; |
| 29 | +using GroupDocs.Conversion.FileTypes; |
| 30 | +using GroupDocs.Conversion.Options.Convert; |
| 31 | +using GroupDocs.Conversion.Options.Load; |
| 32 | + |
| 33 | +Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new DiagramLoadOptions |
| 34 | +{ |
| 35 | + Format = DiagramFileType.Vsd |
| 36 | +}; |
| 37 | + |
| 38 | +using (Converter converter = new Converter("design-diagram.vsd", getLoadOptions)) |
| 39 | +{ |
| 40 | + PdfConvertOptions options = new PdfConvertOptions(); |
| 41 | + converter.Convert("design-diagram.pdf", options); |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +Before v24.10: |
| 46 | + |
| 47 | +```csharp |
| 48 | +using GroupDocs.Conversion; |
| 49 | +using GroupDocs.Conversion.FileTypes; |
| 50 | +using GroupDocs.Conversion.Options.Convert; |
| 51 | +using GroupDocs.Conversion.Options.Load; |
| 52 | + |
| 53 | +Func<LoadOptions> getLoadOptions = () => new DiagramLoadOptions |
| 54 | +{ |
| 55 | + Format = DiagramFileType.Vsd |
| 56 | +}; |
| 57 | + |
| 58 | +using (Converter converter = new Converter("design-diagram.vsd", getLoadOptions)) |
| 59 | +{ |
| 60 | + PdfConvertOptions options = new PdfConvertOptions(); |
| 61 | + converter.Convert("design-diagram.pdf", options); |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +## Load VSDX file |
| 66 | + |
| 67 | +The following code snippet shows how to load a VSDX (Visio Drawing XML) file: |
| 68 | + |
| 69 | +With v24.10 and later: |
| 70 | + |
| 71 | +```csharp |
| 72 | +using GroupDocs.Conversion; |
| 73 | +using GroupDocs.Conversion.FileTypes; |
| 74 | +using GroupDocs.Conversion.Options.Convert; |
| 75 | +using GroupDocs.Conversion.Options.Load; |
| 76 | + |
| 77 | +Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new DiagramLoadOptions |
| 78 | +{ |
| 79 | + Format = DiagramFileType.Vsdx |
| 80 | +}; |
| 81 | + |
| 82 | +using (Converter converter = new Converter("flowchart.vsdx", getLoadOptions)) |
| 83 | +{ |
| 84 | + PdfConvertOptions options = new PdfConvertOptions(); |
| 85 | + converter.Convert("flowchart.pdf", options); |
| 86 | +} |
| 87 | +``` |
| 88 | + |
| 89 | +Before v24.10: |
| 90 | + |
| 91 | +```csharp |
| 92 | +using GroupDocs.Conversion; |
| 93 | +using GroupDocs.Conversion.FileTypes; |
| 94 | +using GroupDocs.Conversion.Options.Convert; |
| 95 | +using GroupDocs.Conversion.Options.Load; |
| 96 | + |
| 97 | +Func<LoadOptions> getLoadOptions = () => new DiagramLoadOptions |
| 98 | +{ |
| 99 | + Format = DiagramFileType.Vsdx |
| 100 | +}; |
| 101 | + |
| 102 | +using (Converter converter = new Converter("flowchart.vsdx", getLoadOptions)) |
| 103 | +{ |
| 104 | + PdfConvertOptions options = new PdfConvertOptions(); |
| 105 | + converter.Convert("flowchart.pdf", options); |
| 106 | +} |
| 107 | +``` |
| 108 | + |
| 109 | +## Load VSD with default font |
| 110 | + |
| 111 | +The following code snippet shows how to load a VSD file with a default font for missing fonts: |
| 112 | + |
| 113 | +With v24.10 and later: |
| 114 | + |
| 115 | +```csharp |
| 116 | +using GroupDocs.Conversion; |
| 117 | +using GroupDocs.Conversion.FileTypes; |
| 118 | +using GroupDocs.Conversion.Options.Convert; |
| 119 | +using GroupDocs.Conversion.Options.Load; |
| 120 | + |
| 121 | +Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new DiagramLoadOptions |
| 122 | +{ |
| 123 | + Format = DiagramFileType.Vsd, |
| 124 | + DefaultFont = "Arial" |
| 125 | +}; |
| 126 | + |
| 127 | +using (Converter converter = new Converter("network-diagram.vsd", getLoadOptions)) |
| 128 | +{ |
| 129 | + PdfConvertOptions options = new PdfConvertOptions(); |
| 130 | + converter.Convert("network-diagram.pdf", options); |
| 131 | +} |
| 132 | +``` |
| 133 | + |
| 134 | +Before v24.10: |
| 135 | + |
| 136 | +```csharp |
| 137 | +using GroupDocs.Conversion; |
| 138 | +using GroupDocs.Conversion.FileTypes; |
| 139 | +using GroupDocs.Conversion.Options.Convert; |
| 140 | +using GroupDocs.Conversion.Options.Load; |
| 141 | + |
| 142 | +Func<LoadOptions> getLoadOptions = () => new DiagramLoadOptions |
| 143 | +{ |
| 144 | + Format = DiagramFileType.Vsd, |
| 145 | + DefaultFont = "Arial" |
| 146 | +}; |
| 147 | + |
| 148 | +using (Converter converter = new Converter("network-diagram.vsd", getLoadOptions)) |
| 149 | +{ |
| 150 | + PdfConvertOptions options = new PdfConvertOptions(); |
| 151 | + converter.Convert("network-diagram.pdf", options); |
| 152 | +} |
| 153 | +``` |
| 154 | + |
| 155 | +## Convert VSDX to Word document |
| 156 | + |
| 157 | +The following code snippet shows how to load a VSDX file and convert it to a Word document: |
| 158 | + |
| 159 | +With v24.10 and later: |
| 160 | + |
| 161 | +```csharp |
| 162 | +using GroupDocs.Conversion; |
| 163 | +using GroupDocs.Conversion.FileTypes; |
| 164 | +using GroupDocs.Conversion.Options.Convert; |
| 165 | +using GroupDocs.Conversion.Options.Load; |
| 166 | + |
| 167 | +Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new DiagramLoadOptions |
| 168 | +{ |
| 169 | + Format = DiagramFileType.Vsdx |
| 170 | +}; |
| 171 | + |
| 172 | +using (Converter converter = new Converter("process-flow.vsdx", getLoadOptions)) |
| 173 | +{ |
| 174 | + WordProcessingConvertOptions options = new WordProcessingConvertOptions(); |
| 175 | + converter.Convert("process-flow.docx", options); |
| 176 | +} |
| 177 | +``` |
| 178 | + |
| 179 | +Before v24.10: |
| 180 | + |
| 181 | +```csharp |
| 182 | +using GroupDocs.Conversion; |
| 183 | +using GroupDocs.Conversion.FileTypes; |
| 184 | +using GroupDocs.Conversion.Options.Convert; |
| 185 | +using GroupDocs.Conversion.Options.Load; |
| 186 | + |
| 187 | +Func<LoadOptions> getLoadOptions = () => new DiagramLoadOptions |
| 188 | +{ |
| 189 | + Format = DiagramFileType.Vsdx |
| 190 | +}; |
| 191 | + |
| 192 | +using (Converter converter = new Converter("process-flow.vsdx", getLoadOptions)) |
| 193 | +{ |
| 194 | + WordProcessingConvertOptions options = new WordProcessingConvertOptions(); |
| 195 | + converter.Convert("process-flow.docx", options); |
| 196 | +} |
| 197 | +``` |
| 198 | + |
| 199 | +## Convert between diagram formats |
| 200 | + |
| 201 | +The following code snippet shows how to convert from VSD to VSDX format: |
| 202 | + |
| 203 | +With v24.10 and later: |
| 204 | + |
| 205 | +```csharp |
| 206 | +using GroupDocs.Conversion; |
| 207 | +using GroupDocs.Conversion.FileTypes; |
| 208 | +using GroupDocs.Conversion.Options.Convert; |
| 209 | +using GroupDocs.Conversion.Options.Load; |
| 210 | + |
| 211 | +Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new DiagramLoadOptions |
| 212 | +{ |
| 213 | + Format = DiagramFileType.Vsd |
| 214 | +}; |
| 215 | + |
| 216 | +using (Converter converter = new Converter("legacy-diagram.vsd", getLoadOptions)) |
| 217 | +{ |
| 218 | + DiagramConvertOptions options = new DiagramConvertOptions |
| 219 | + { |
| 220 | + Format = DiagramFileType.Vsdx |
| 221 | + }; |
| 222 | + converter.Convert("legacy-diagram.vsdx", options); |
| 223 | +} |
| 224 | +``` |
| 225 | + |
| 226 | +Before v24.10: |
| 227 | + |
| 228 | +```csharp |
| 229 | +using GroupDocs.Conversion; |
| 230 | +using GroupDocs.Conversion.FileTypes; |
| 231 | +using GroupDocs.Conversion.Options.Convert; |
| 232 | +using GroupDocs.Conversion.Options.Load; |
| 233 | + |
| 234 | +Func<LoadOptions> getLoadOptions = () => new DiagramLoadOptions |
| 235 | +{ |
| 236 | + Format = DiagramFileType.Vsd |
| 237 | +}; |
| 238 | + |
| 239 | +using (Converter converter = new Converter("legacy-diagram.vsd", getLoadOptions)) |
| 240 | +{ |
| 241 | + DiagramConvertOptions options = new DiagramConvertOptions |
| 242 | + { |
| 243 | + Format = DiagramFileType.Vsdx |
| 244 | + }; |
| 245 | + converter.Convert("legacy-diagram.vsdx", options); |
| 246 | +} |
| 247 | +``` |
| 248 | + |
| 249 | +## Convert VSDX to PowerPoint |
| 250 | + |
| 251 | +The following code snippet shows how to load a VSDX file and convert it to a PowerPoint presentation: |
| 252 | + |
| 253 | +With v24.10 and later: |
| 254 | + |
| 255 | +```csharp |
| 256 | +using GroupDocs.Conversion; |
| 257 | +using GroupDocs.Conversion.FileTypes; |
| 258 | +using GroupDocs.Conversion.Options.Convert; |
| 259 | +using GroupDocs.Conversion.Options.Load; |
| 260 | + |
| 261 | +Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new DiagramLoadOptions |
| 262 | +{ |
| 263 | + Format = DiagramFileType.Vsdx |
| 264 | +}; |
| 265 | + |
| 266 | +using (Converter converter = new Converter("org-chart.vsdx", getLoadOptions)) |
| 267 | +{ |
| 268 | + PresentationConvertOptions options = new PresentationConvertOptions(); |
| 269 | + converter.Convert("org-chart.pptx", options); |
| 270 | +} |
| 271 | +``` |
| 272 | + |
| 273 | +Before v24.10: |
| 274 | + |
| 275 | +```csharp |
| 276 | +using GroupDocs.Conversion; |
| 277 | +using GroupDocs.Conversion.FileTypes; |
| 278 | +using GroupDocs.Conversion.Options.Convert; |
| 279 | +using GroupDocs.Conversion.Options.Load; |
| 280 | + |
| 281 | +Func<LoadOptions> getLoadOptions = () => new DiagramLoadOptions |
| 282 | +{ |
| 283 | + Format = DiagramFileType.Vsdx |
| 284 | +}; |
| 285 | + |
| 286 | +using (Converter converter = new Converter("org-chart.vsdx", getLoadOptions)) |
| 287 | +{ |
| 288 | + PresentationConvertOptions options = new PresentationConvertOptions(); |
| 289 | + converter.Convert("org-chart.pptx", options); |
| 290 | +} |
| 291 | +``` |
0 commit comments