أول طلب Aspose.Diagram - Hello World
Contents
[
Hide
]
يوضح موضوع المبتدئين هذا كيف يمكن للمطورين إنشاء تطبيق أول بسيط (Hello World) باستخدام Aspose.Diagram ‘بسيط API. يقوم التطبيق بإنشاء ملف Microsoft Visio بالكلمات Hello World في الصفحة.
إنشاء تطبيق Hello World
لإنشاء تطبيق Hello World باستخدام Aspose.Diagram API:
- قم بإنشاء مثيل لفئة المصنف.
- تطبيق الرخصة:
- إذا كنت قد اشتريت ترخيصًا ، فاستخدم الترخيص الموجود في التطبيق الخاص بك للوصول إلى الوظائف الكاملة Aspose.Diagram
- إذا كنت تستخدم الإصدار التقييمي للمكون (إذا كنت تستخدم Aspose.Diagram بدون ترخيص) ، فتخط هذه الخطوة.
- قم بتكوين ملف Microsoft Visio جديد ، أو افتح ملفًا موجودًا تريد إضافة / تحديث جزء منه.
- أدخل الكلماتHello World! في الصفحة التي تم الوصول إليها.
- قم بإنشاء ملف Microsoft Visio المعدل.
توضح الأمثلة أدناه الخطوات المذكورة أعلاه.
إنشاء Diagram
ينشئ المثال التالي diagram جديدًا من البداية ، ويكتب الكلمات “Hello World!” في الصفحة الأولى ، ويحفظ الملف.
قم بإنشاء ملف visio جديد
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
import aspose.diagram | |
from aspose.diagram import * | |
#// Initialize a Diagram class | |
diagram = Diagram() | |
#// Save diagram in the VSDX format | |
diagram.save("CreateNewVisio_out.vsdx", SaveFileFormat.VSDX) |
فتح ملف موجود
يفتح المثال التالي ملف قالب Microsoft Visio موجود ، ويكتب الكلمات “Hello World!” في الصفحة الأولى ، ويحفظ 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
import aspose.diagram | |
from aspose.diagram import * | |
diagram = Diagram(os.path.join(sourceDir, "Basic Shapes.vss")) | |
#// Add a new hello world rectangle shape | |
shapeId = diagram.add_shape(4.25, 5.5, 2, 1, "Rectangle", 0) | |
shape = diagram.pages[0].shapes.get_shape(shapeId) | |
shape.text.value.add(Txt("Hello World")) | |
#// Save diagram in the VSDX format | |
diagram.save("CreateHelloWorldVisio_out.vsdx", SaveFileFormat.VSDX) |