Microsoft® Visio फ़ाइल मेटाडेटा को Java के माध्यम से प्रबंधित करें
सर्वर साइड Java API का उपयोग करके अंतर्निर्मित और कस्टम Visio फ़ाइल गुण देखें, जोड़ें, अपडेट करें, निकालें या निकालें।
Java Visio API सिस्टम-डिफ़ाइंड (अंतर्निहित) गुणों जैसे शीर्षक, लेखक का नाम, दस्तावेज़ आँकड़े आदि के साथ-साथ उपयोगकर्ता-परिभाषित (कस्टम) गुणों के प्रबंधन का समर्थन करता है नाम-मूल्य जोड़ी के रूप में। वहाँ है Diagram कक्षा फ़ाइलें लोड करने के लिए, और पृष्ठ संग्रह पृष्ठों के संग्रह के साथ-साथ से संबंधित है पेज क्लास एकल पृष्ठ का प्रतिनिधित्व करने के लिए। इन वर्गों के साथ, दस्तावेज़ गुण, कस्टमप्रॉप मेटाडेटा प्रबंधन के लिए प्रक्रिया को सरल बनाते हैं।
अंतर्निहित गुणों का प्रबंधन
सिस्टम-परिभाषित गुणों के प्रबंधन के लिए, API प्रदान करता है दस्तावेजों की संपत्ति , और प्रोग्रामर आसानी से एक अंतर्निहित संपत्ति तक पहुंच सकते हैं और इसके मूल्य को अपडेट कर सकते हैं।
Java अंतर्निहित गुणों को प्रबंधित करने के लिए कोड
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(AutoFitShapesInVisio.class); | |
// load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "BFlowcht.vsdx"); | |
//// Display Visio version and document modification time at different stages | |
System.out.println(diagram.getVersion()); | |
System.out.println(diagram.getDocumentProps().getBuildNumberCreated()); | |
System.out.println(diagram.getDocumentProps().getBuildNumberEdited()); | |
System.out.println(diagram.getDocumentProps().getTimeCreated()); | |
System.out.println(diagram.getDocumentProps().getTimeEdited()); | |
System.out.println(diagram.getDocumentProps().getTimePrinted()); | |
System.out.println(diagram.getDocumentProps().getTimeSaved()); | |
System.out.println(diagram.getDocumentProps().getCustomProps().getCount()); |
कस्टम परिभाषित गुणों का प्रबंधन
उपयोगकर्ता द्वारा परिभाषित संपत्तियों के प्रबंधन के लिए, API प्रदान करता है कस्टमप्रॉप्स और डेवलपर पहले से जोड़ी गई संपत्तियों तक आसानी से पहुंच सकते हैं और साथ ही नई संपत्तियां भी जोड़ सकते हैं। कस्टम गुण जोड़ने के लिए, विधि जोड़ें संपत्ति जोड़ता है और नई संपत्ति के लिए एक संदर्भ देता है a कस्टमप्रॉप वस्तु। CustomProp वर्ग का उपयोग दस्तावेज़ संपत्ति के नाम, मूल्य और प्रकार को पुनः प्राप्त करने के लिए किया जाता है: नाम , कस्टम मूल्य , सम्पत्ती के प्रकार गणना मूल्य।
Java Visio फ़ाइल में मेटाडेटा जोड़ने के लिए कोड
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(AutoFitShapesInVisio.class); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//// Get CustomProperties of diagram | |
CustomPropCollection customProperties = diagram.getDocumentProps().getCustomProps(); | |
//Set property of CustomProp | |
CustomProp customProp = new CustomProp(); | |
customProp.setPropType(PropType.STRING); | |
customProp.getCustomValue().setValueString ("Test"); | |
//Add CustomProp to Collection | |
customProperties.add(customProp); |
Java Visio फ़ाइल में संपत्ति निकालने के लिए कोड
// For complete examples and data files, please go to https://github.com/aspose-diagram/Aspose.Diagram-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(AutoFitShapesInVisio.class); | |
// Load a Visio diagram | |
Diagram diagram = new Diagram(dataDir + "Drawing1.vsdx"); | |
//// Get CustomProperties of diagram | |
CustomPropCollection customProperties = diagram.getDocumentProps().getCustomProps(); | |
//Remove CustomProp | |
for (int i = 0; i < customProperties.getCount(); i++) | |
{ | |
CustomProp customProp = customProperties.get(i); | |
if (customProp.getName()== "Test") | |
{ | |
customProperties.remove(customProp); | |
} | |
} |