Aggiungi filigrana a Visio
Creazione di un numero Diagram
Aspose.Diagram for .NET consente di leggere e creare Microsoft Visio diagrammi dall’interno delle proprie applicazioni, senza Microsoft Office Automazione. Il primo passaggio durante la creazione di nuovi documenti è creare un numero diagram. Quindiaggiungere forme e connettoriper creare diagram. Utilizzare il costruttore predefinito diDiagram class per creare un nuovo diagram.
Esempio di programmazione
// 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); |
Questo esempio funziona come segue:
- Creare un oggetto della classe Diagram.
- Aggiungi filigrana a visio nella pagina
- Chiama il metodo Save dell’oggetto classe Diagram e passa anche il percorso file completo e l’oggetto DiagramSaveOptions.
Aggiungi un esempio di programmazione in filigrana
Il codice di esempio seguente mostra come aggiungere filigrana nel file Visio diagram.
// 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.vsd"); | |
// Get Visio diagram page | |
Aspose.Diagram.Page page = diagram.Pages.GetPage("Page-1"); | |
double pinx = page.PageSheet.PageProps.PageWidth.Value / 2; | |
double piny = page.PageSheet.PageProps.PageHeight.Value / 2; | |
double width = page.PageSheet.PageProps.PageWidth.Value; | |
double height = page.PageSheet.PageProps.PageHeight.Value; | |
//Add watermark | |
Shape shape = page.AddText(pinx, piny, width, height, "Test text","Calibri","#a5a5a5",0.25); | |
diagram.Save(dataDir + "Watermark.vsdx", SaveFileFormat.VSDX); | |
} | |