Microsoft® Visio Dosya Meta Verilerini Java aracılığıyla yönetin
Sunucu tarafı Java API'lerini kullanarak yerleşik ve özel Visio dosya özelliklerini görüntüleyin, ekleyin, güncelleyin, kaldırın veya çıkarın.
Java Visio API ad-değer çifti biçimindeki kullanıcı tanımlı (özel) özelliklerin yanı sıra başlık, yazar adı, belge istatistikleri vb. gibi sistem tanımlı (yerleşik) özelliklerin yönetimini destekler. Orada Diagram sınıfı dosyaları yüklemek için ve Sayfa Koleksiyonu yanı sıra sayfaların toplanması ile ilgilenir sayfa sınıfı tek Sayfayı temsil etmek için. Bu sınıflarla birlikte, documentproperties, customprops, metadata yönetimi için süreci basitleştirir.
Yerleşik Özellikleri Yönetme
Sistem tanımlı özellikleri yönetmek için API şunları sağlar: döküman özellikleri ve programcılar yerleşik bir özelliğe kolayca erişebilir ve değerini güncelleyebilir.
Java Yerleşik Özellikleri Yönetmek için Kod
// 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()); |
Özel Tanımlı Özellikleri Yönetme
Kullanıcı tanımlı özellikleri yönetmek için API şunları sağlar: özel aksesuarlar ve geliştiriciler, önceden eklenmiş özelliklere kolayca erişebilir ve yeni özellikler ekleyebilir. Özel özellikler eklemek için, Yöntem ekle özelliği ekler ve yeni özellik için bir referans olarak döndürür. ÖzelProp nesne. CustomProp sınıfı, belge özelliğinin adını, değerini ve türünü şu şekilde almak için kullanılır: İsim , Özel değer , Emlak Tipi numaralandırma değerleri.
Visio Dosyasına Meta Veri Eklemek için Java Kodu
// 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); |
Visio Dosyasındaki Mülkü Kaldırmak için Java Kodu
// 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); | |
} | |
} |