أضف العلامة المائية إلى Visio
Contents
[
Hide
]
إنشاء Diagram
يتيح لك Aspose.Diagram for .NET قراءة وإنشاء Microsoft Visio الرسوم التخطيطية من داخل التطبيقات الخاصة بك ، بدون أتمتة Microsoft Office. الخطوة الأولى عند تكوين وثائق جديدة هي تكوين diagram. ثمإضافة الأشكال والموصلاتلإنشاء diagram. استخدم المُنشئ الافتراضي لـDiagram فئة لإنشاء diagram جديد.
عينة البرمجة
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled 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); |
هذا المثال يعمل على النحو التالي:
- قم بتكوين عنصر للفئة Diagram.
- أضف العلامة المائية إلى visio في الصفحة
- استدعاء طريقة حفظ لكائن الفئة Diagram وأيضا تمرير مسار الملف الكامل وكائن DiagramSaveOptions.
أضف عينة برمجة العلامة المائية
يوضح رمز المثال التالي كيفية إضافة علامة مائية في Visio diagram.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled 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.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); | |
} | |