أول طلب Aspose.Diagram - Hello World
إنشاء تطبيق Hello World
تؤدي الخطوات أدناه إلى إنشاء تطبيق Hello World باستخدام Aspose.Diagram API:
- قم بإنشاء مثيل لـDiagram صف دراسي.
- إذا كان لديك ترخيص ، إذنقم بتطبيقه. إذا كنت تستخدم الإصدار التقييمي ، فتخط سطور التعليمات البرمجية المتعلقة بالترخيص.
- قم بتكوين ملف Visio جديد ، أو افتح ملف Visio موجود.
- قم بإنشاء مربع نص جديد.
- أدخل الكلماتHello World! في مربع نص.
- قم بإنشاء ملف Microsoft Visio المعدل.
يتم توضيح تنفيذ الخطوات المذكورة أعلاه في الأمثلة أدناه.
نموذج التعليمات البرمجية: إنشاء Diagram جديد
المثال التالي ينشئ diagram جديد من الصفر ، يكتب Hello World! في الصفحة الأولى ويحفظ الملف Visio.
// 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); |
نموذج التعليمات البرمجية: فتح ملف موجود
يفتح المثال التالي ملف قالب Microsoft Visio موجود باسم “Sample.vsdx” ، بإدخال “Hello World!” نص في الصفحة الأولى ويحفظ diagram.
// 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); |