public static void GenerateCustomXmlPropertiesPart1Content(CustomXmlPropertiesPart customXmlPropertiesPart1) { var dataStoreItem1 = new DocumentFormat.OpenXml.CustomXmlDataProperties.DataStoreItem() { ItemId = "{58BABFA7-2624-4FA3-9991-4F285D687B5F}" }; dataStoreItem1.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); var schemaReferences1 = new DocumentFormat.OpenXml.CustomXmlDataProperties.SchemaReferences(); var schemaReference1 = new DocumentFormat.OpenXml.CustomXmlDataProperties.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/metadata/properties" }; var schemaReference2 = new DocumentFormat.OpenXml.CustomXmlDataProperties.SchemaReference() { Uri = "http://schemas.microsoft.com/office/infopath/2007/PartnerControls" }; schemaReferences1.Append(schemaReference1); schemaReferences1.Append(schemaReference2); dataStoreItem1.Append(schemaReferences1); customXmlPropertiesPart1.DataStoreItem = dataStoreItem1; }
private void AddOrReplaceCustomxmlPath() { CheckIfTypedSettingIsNull(); using (WordprocessingDocument document = WordprocessingDocument.Open(DocumentFilePath, true)) { string dataStoreItemId = TypedSetting.DataStoreItemId; CustomXmlPart xmlPart = GetCustomXmlPart(document, dataStoreItemId); if (xmlPart != null) { FileStream fs = new FileStream(TypedSetting.XmlPartFilePath, FileMode.Open); xmlPart.FeedData(fs); } else { xmlPart = document.MainDocumentPart.AddCustomXmlPart(CustomXmlPartType.CustomXml); FileStream fs = new FileStream(TypedSetting.XmlPartFilePath, FileMode.Open); xmlPart.FeedData(fs); CustomXmlPropertiesPart xmlPropertiesPart = xmlPart.AddNewPart <CustomXmlPropertiesPart>(TypedSetting.ContentTypeId); DataStoreItem dataStoreItem = new DataStoreItem(); dataStoreItem.ItemId = dataStoreItemId; xmlPropertiesPart.DataStoreItem = dataStoreItem; } } }
/// <summary> /// Adds the custom XML part with a custom XML properties to the main document part. /// </summary> /// <param name="mainPart">The main document part.</param> /// <param name="customXml">The custom XML.</param> /// <param name="customXmlProperties">The custom XML properties.</param> public static void AddCustomXmlPart( this MainDocumentPart mainPart, XDocument customXml, XDocument customXmlProperties) { CustomXmlPart customXmlPart = mainPart.AddNewPart <CustomXmlPart>(); CustomXmlPropertiesPart customXmlPropertiesPart = customXmlPart.AddNewPart <CustomXmlPropertiesPart>(); customXmlPropertiesPart.PutXDocument(customXmlProperties); customXmlPart.PutXDocument(customXml); }
/// <summary> /// Gets the store item id. /// </summary> /// <param name="mainDocumentPart">The main document part.</param> /// <returns></returns> public string GetStoreItemId(MainDocumentPart mainDocumentPart) { if (mainDocumentPart == null) { throw new ArgumentNullException("mainDocumentPart"); } CustomXmlPart customXmlPart = GetCustomXmlPart(mainDocumentPart); CustomXmlPropertiesPart customXmlPropertiesPart = customXmlPart.CustomXmlPropertiesPart; return(customXmlPropertiesPart.DataStoreItem.ItemId.ToString()); }
static Uri CreateCustomXML(WordprocessingDocument document, XElement customXML, out string guid) { CustomXmlPart XMLPart = document.MainDocumentPart.AddCustomXmlPart(CustomXmlPartType.CustomXml); StreamWriter sw = new StreamWriter(XMLPart.GetStream(FileMode.Create, FileAccess.ReadWrite)); sw.Write(customXML.ToString()); sw.Flush(); sw.Close(); guid = "{" + Guid.NewGuid().ToString().ToUpper() + "}"; CustomXmlPropertiesPart propPart = XMLPart.AddNewPart <CustomXmlPropertiesPart>(); propPart.DataStoreItem = new DataStoreItem(new SchemaReferences()) { ItemId = guid }; return(XMLPart.Uri); }
/// <summary> /// Generates the content of the custom XML properties part. /// </summary> /// <param name="customXmlPropertiesPart">The custom XML properties part1.</param> private void GenerateCustomXmlPropertiesPartContent(CustomXmlPropertiesPart customXmlPropertiesPart) { DataStoreItem dataStoreItem = new DataStoreItem() { ItemId = "{" + Guid.NewGuid().ToString().ToUpper() + "}" }; dataStoreItem.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); SchemaReferences schemaReferences = new SchemaReferences(); SchemaReference schemaReference = new SchemaReference() { Uri = namespaceUri }; schemaReferences.Append(schemaReference); dataStoreItem.Append(schemaReferences); customXmlPropertiesPart.DataStoreItem = dataStoreItem; }
public static void GenerateCustomXmlPropertiesPart3Content(CustomXmlPropertiesPart customXmlPropertiesPart3) { var dataStoreItem3 = new Ds.DataStoreItem { ItemId = "{4FC9BDEA-EA46-43A8-AA87-476FAB077CDB}" }; dataStoreItem3.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); var schemaReferences3 = new Ds.SchemaReferences(); var schemaReference15 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/sharepoint/v3/contenttype/forms" }; schemaReferences3.Append(schemaReference15); dataStoreItem3.Append(schemaReferences3); customXmlPropertiesPart3.DataStoreItem = dataStoreItem3; }
public static void GenerateCustomXmlPropertiesPart3Content(CustomXmlPropertiesPart customXmlPropertiesPart3) { Ds.DataStoreItem dataStoreItem3 = new Ds.DataStoreItem() { ItemId = "{5804A2E3-5823-485C-929F-CC83322FF56F}" }; dataStoreItem3.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); Ds.SchemaReferences schemaReferences3 = new Ds.SchemaReferences(); Ds.SchemaReference schemaReference23 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/sharepoint/v3/contenttype/forms" }; schemaReferences3.Append(schemaReference23); dataStoreItem3.Append(schemaReferences3); customXmlPropertiesPart3.DataStoreItem = dataStoreItem3; }
/// <summary> /// Adds the custom XML part. /// </summary> /// <param name="mainDocumentPart">The main part.</param> /// <param name="rootElementName">Name of the root element.</param> /// <returns> /// Returns CustomXmlPart /// </returns> public CustomXmlPart AddCustomXmlPart(MainDocumentPart mainDocumentPart, string rootElementName) { if (mainDocumentPart == null) { throw new ArgumentNullException("mainDocumentPart"); } if (string.IsNullOrEmpty(rootElementName)) { throw new ArgumentNullException("rootElementName"); } XName rootElementXName = XName.Get(rootElementName, this.namespaceUri); XElement rootElement = new XElement(rootElementXName); CustomXmlPart customXmlPart = mainDocumentPart.AddCustomXmlPart(CustomXmlPartType.CustomXml); CustomXmlPropertiesPart customXmlPropertiesPart = customXmlPart.AddNewPart <CustomXmlPropertiesPart>(); GenerateCustomXmlPropertiesPartContent(customXmlPropertiesPart); WriteElementToCustomXmlPart(customXmlPart, rootElement); return(customXmlPart); }
private void CreateParts(WordprocessingDocument document) { DocxBase.CurrentTitle = DocxServiceProvinceRes.Title; ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart <ExtendedFilePropertiesPart>("rId3"); DocxBase.GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1); MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart(); GenerateMainDocumentPart1Content(mainDocumentPart1); FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart <FontTablePart>("rId13"); DocxBase.GenerateFontTablePart1Content(fontTablePart1); StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart <StyleDefinitionsPart>("rId3"); DocxBase.GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1); EndnotesPart endnotesPart1 = mainDocumentPart1.AddNewPart <EndnotesPart>("rId7"); DocxBase.GenerateEndnotesPart1Content(endnotesPart1); FooterPart footerPart1 = mainDocumentPart1.AddNewPart <FooterPart>("rId12"); DocxBase.GenerateFooterPart1Content(footerPart1); NumberingDefinitionsPart numberingDefinitionsPart1 = mainDocumentPart1.AddNewPart <NumberingDefinitionsPart>("rId2"); DocxBase.GenerateNumberingDefinitionsPart1Content(numberingDefinitionsPart1); CustomXmlPart customXmlPart1 = mainDocumentPart1.AddNewPart <CustomXmlPart>("application/xml", "rId1"); DocxBase.GenerateCustomXmlPart1Content(customXmlPart1); CustomXmlPropertiesPart customXmlPropertiesPart1 = customXmlPart1.AddNewPart <CustomXmlPropertiesPart>("rId1"); DocxBase.GenerateCustomXmlPropertiesPart1Content(customXmlPropertiesPart1); FootnotesPart footnotesPart1 = mainDocumentPart1.AddNewPart <FootnotesPart>("rId6"); DocxBase.GenerateFootnotesPart1Content(footnotesPart1); HeaderPart headerPart1 = mainDocumentPart1.AddNewPart <HeaderPart>("rId11"); DocxBase.GenerateHeaderPart1Content(headerPart1); WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart <WebSettingsPart>("rId5"); DocxBase.GenerateWebSettingsPart1Content(webSettingsPart1); //ChartPart chartPart1 = mainDocumentPart1.AddNewPart<ChartPart>("rId10"); //DocxBase.GenerateChartPart1Content(chartPart1); //EmbeddedPackagePart embeddedPackagePart1 = chartPart1.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId3"); //DocxBase.GenerateEmbeddedPackagePart1Content(embeddedPackagePart1); //ChartColorStylePart chartColorStylePart1 = chartPart1.AddNewPart<ChartColorStylePart>("rId2"); //DocxBase.GenerateChartColorStylePart1Content(chartColorStylePart1); //ChartStylePart chartStylePart1 = chartPart1.AddNewPart<ChartStylePart>("rId1"); //DocxBase.GenerateChartStylePart1Content(chartStylePart1); DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart <DocumentSettingsPart>("rId4"); DocxBase.GenerateDocumentSettingsPart1Content(documentSettingsPart1); //ChartPart chartPart2 = mainDocumentPart1.AddNewPart<ChartPart>("rId9"); //DocxBase.GenerateChartPart2Content(chartPart2); //EmbeddedPackagePart embeddedPackagePart2 = chartPart2.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId3"); //DocxBase.GenerateEmbeddedPackagePart2Content(embeddedPackagePart2); //ChartColorStylePart chartColorStylePart2 = chartPart2.AddNewPart<ChartColorStylePart>("rId2"); //DocxBase.GenerateChartColorStylePart2Content(chartColorStylePart2); //ChartStylePart chartStylePart2 = chartPart2.AddNewPart<ChartStylePart>("rId1"); //DocxBase.GenerateChartStylePart2Content(chartStylePart2); ThemePart themePart1 = mainDocumentPart1.AddNewPart <ThemePart>("rId14"); DocxBase.GenerateThemePart1Content(themePart1); foreach (UsedHyperlink usedHyperlink in DocxBase.UsedHyperlinkList) { mainDocumentPart1.AddHyperlinkRelationship(new System.Uri(usedHyperlink.URL, System.UriKind.Absolute), true, usedHyperlink.Id.ToString()); } DocxBase.SetPackageProperties(document); }
/// <summary> /// Saves the DOM into the CustomXmlPropertiesPart. /// </summary> /// <param name="openXmlPart">Specifies the part to save to.</param> public void Save(CustomXmlPropertiesPart openXmlPart) { base.SaveToPart(openXmlPart); }
private void CreateParts(PresentationDocument document, PresentationGenerationData data) { ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart <ExtendedFilePropertiesPart>("rId3"); GenerateExtendedFilePropertiesPartHelper.GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1); PresentationPart presentationPart1 = document.AddPresentationPart(); GeneratePresentationPartHelper.GeneratePresentationPart1Content(presentationPart1); CommentAuthorsPart commentAuthorsPart1 = presentationPart1.AddNewPart <CommentAuthorsPart>("rId8"); GenerateCommentAuthorsPartHelper.GenerateCommentAuthorsPart1Content(commentAuthorsPart1); CustomXmlPart customXmlPart1 = presentationPart1.AddNewPart <CustomXmlPart>("application/xml", "rId3"); GenerateCustomXmlPartHelper.GenerateCustomXmlPart1Content(customXmlPart1); CustomXmlPropertiesPart customXmlPropertiesPart1 = customXmlPart1.AddNewPart <CustomXmlPropertiesPart>("rId1"); GenerateCustomXmlPropertiesPartHelper.GenerateCustomXmlPropertiesPart1Content(customXmlPropertiesPart1); HandoutMasterPart handoutMasterPart1 = presentationPart1.AddNewPart <HandoutMasterPart>("rId7"); GenerateHandoutMasterPartHelper.GenerateHandoutMasterPart1Content(handoutMasterPart1); ThemePart themePart1 = handoutMasterPart1.AddNewPart <ThemePart>("rId1"); GenerateThemePartHelper.GenerateThemePart1Content(themePart1); TableStylesPart tableStylesPart1 = presentationPart1.AddNewPart <TableStylesPart>("rId12"); GenerateTableStylesPartHelper.GenerateTableStylesPart1Content(tableStylesPart1); CustomXmlPart customXmlPart2 = presentationPart1.AddNewPart <CustomXmlPart>("application/xml", "rId2"); GenerateCustomXmlPartHelper.GenerateCustomXmlPart2Content(customXmlPart2); CustomXmlPropertiesPart customXmlPropertiesPart2 = customXmlPart2.AddNewPart <CustomXmlPropertiesPart>("rId1"); GenerateCustomXmlPropertiesPartHelper.GenerateCustomXmlPropertiesPart2Content(customXmlPropertiesPart2); CustomXmlPart customXmlPart3 = presentationPart1.AddNewPart <CustomXmlPart>("application/xml", "rId1"); GenerateCustomXmlPartHelper.GenerateCustomXmlPart3Content(customXmlPart3); CustomXmlPropertiesPart customXmlPropertiesPart3 = customXmlPart3.AddNewPart <CustomXmlPropertiesPart>("rId1"); GenerateCustomXmlPropertiesPartHelper.GenerateCustomXmlPropertiesPart3Content(customXmlPropertiesPart3); NotesMasterPart notesMasterPart1 = presentationPart1.AddNewPart <NotesMasterPart>("rId6"); GenerateNotesMasterPartHelper.GenerateNotesMasterPart1Content(notesMasterPart1); ThemePart themePart2 = notesMasterPart1.AddNewPart <ThemePart>("rId1"); GenerateThemePartHelper.GenerateThemePart2Content(themePart2); ThemePart themePart3 = presentationPart1.AddNewPart <ThemePart>("rId11"); GenerateThemePartHelper.GenerateThemePart3Content(themePart3); SlidePart slidePart1 = presentationPart1.AddNewPart <SlidePart>("rId5"); GenerateSlidePartHelper.GenerateSlidePart1Content(slidePart1, data); var pictureType = string.Empty; if (!string.IsNullOrEmpty(data.PictureType)) { pictureType = data.PictureType; } else { pictureType = "image/png"; } ImagePart imagePart1 = slidePart1.AddNewPart <ImagePart>(pictureType, "rId3"); GenerateImagePartHelper.GenerateImagePart1Content(imagePart1, data.PictureContent); NotesSlidePart notesSlidePart1 = slidePart1.AddNewPart <NotesSlidePart>("rId2"); GenerateNotesSlidePartHelper.GenerateNotesSlidePart1Content(notesSlidePart1); notesSlidePart1.AddPart(slidePart1, "rId2"); notesSlidePart1.AddPart(notesMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart1 = slidePart1.AddNewPart <SlideLayoutPart>("rId1"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart1Content(slideLayoutPart1); SlideMasterPart slideMasterPart1 = slideLayoutPart1.AddNewPart <SlideMasterPart>("rId1"); GenerateSlideMasterPartHelper.GenerateSlideMasterPart1Content(slideMasterPart1); SlideLayoutPart slideLayoutPart2 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId8"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart2Content(slideLayoutPart2); slideLayoutPart2.AddPart(slideMasterPart1, "rId1"); ImagePart imagePart2 = slideMasterPart1.AddNewPart <ImagePart>("image/jpeg", "rId13"); GenerateImagePartHelper.GenerateImagePart2Content(imagePart2); SlideLayoutPart slideLayoutPart3 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId3"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart3Content(slideLayoutPart3); slideLayoutPart3.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart4 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId7"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart4Content(slideLayoutPart4); slideLayoutPart4.AddPart(slideMasterPart1, "rId1"); slideMasterPart1.AddPart(themePart3, "rId12"); slideMasterPart1.AddPart(slideLayoutPart1, "rId2"); SlideLayoutPart slideLayoutPart5 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId1"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart5Content(slideLayoutPart5); ImagePart imagePart3 = slideLayoutPart5.AddNewPart <ImagePart>("image/jpeg", "rId3"); GenerateImagePartHelper.GenerateImagePart3Content(imagePart3); ImagePart imagePart4 = slideLayoutPart5.AddNewPart <ImagePart>("image/png", "rId2"); GenerateImagePartHelper.GenerateImagePart4Content(imagePart4); slideLayoutPart5.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart6 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId6"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart6Content(slideLayoutPart6); slideLayoutPart6.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart7 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId11"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart7Content(slideLayoutPart7); slideLayoutPart7.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart8 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId5"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart8Content(slideLayoutPart8); slideLayoutPart8.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart9 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId10"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart9Content(slideLayoutPart9); slideLayoutPart9.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart10 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId4"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart10Content(slideLayoutPart10); slideLayoutPart10.AddPart(slideMasterPart1, "rId1"); SlideLayoutPart slideLayoutPart11 = slideMasterPart1.AddNewPart <SlideLayoutPart>("rId9"); GenerateSlideLayoutPartHelper.GenerateSlideLayoutPart11Content(slideLayoutPart11); slideLayoutPart11.AddPart(slideMasterPart1, "rId1"); ViewPropertiesPart viewPropertiesPart1 = presentationPart1.AddNewPart <ViewPropertiesPart>("rId10"); GenerateViewPropertiesPartHelper.GenerateViewPropertiesPart1Content(viewPropertiesPart1); presentationPart1.AddPart(slideMasterPart1, "rId4"); PresentationPropertiesPart presentationPropertiesPart1 = presentationPart1.AddNewPart <PresentationPropertiesPart>("rId9"); GeneratePresentationPropertiesPartHelper.GeneratePresentationPropertiesPart1Content(presentationPropertiesPart1); CustomFilePropertiesPart customFilePropertiesPart1 = document.AddNewPart <CustomFilePropertiesPart>("rId4"); CustomFilePropertiesPartHelper.GenerateCustomFilePropertiesPart1Content(customFilePropertiesPart1); SetPackageProperties(document); }
/// <summary> /// DataStoreItem constructor. /// </summary> /// <param name="ownerPart">The owner part of the DataStoreItem.</param> internal DataStoreItem(CustomXmlPropertiesPart ownerPart) : base(ownerPart) { }
public static void InsertCustomXmlForPpt(string pptFileName, string customXML) { using (PresentationDocument openXmlDoc = PresentationDocument.Open(pptFileName, true)) { // Create a new custom XML part int count = openXmlDoc.PresentationPart.Parts.Count(); string customXmlId = string.Format("rId{0}", count + 1); CustomXmlPart customXmlPart = openXmlDoc.PresentationPart.AddCustomXmlPart(CustomXmlPartType.CustomXml, customXmlId); using (Stream outputStream = customXmlPart.GetStream()) { using (StreamWriter ts = new StreamWriter(outputStream)) { ts.Write(customXML); } } // Add datastore so that the xml will persist after the document is modified count = customXmlPart.Parts.Count(); CustomXmlPropertiesPart customXmlPropertiesPart = customXmlPart.AddNewPart <CustomXmlPropertiesPart>(string.Format("rId{0}", count + 1)); DataStoreItem dataStoreItem = new DataStoreItem() { ItemId = string.Format("{0}", Guid.NewGuid()) }; dataStoreItem.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); SchemaReferences schemaReferences = new SchemaReferences(); SchemaReference schemaReference = new SchemaReference() { Uri = "http://www.w3.org/2001/XMLSchema" }; schemaReferences.Append(schemaReference); dataStoreItem.Append(schemaReferences); customXmlPropertiesPart.DataStoreItem = dataStoreItem; // Add the xml to the customer data section of the document CustomerData customerData = new CustomerData() { Id = customXmlId }; if (openXmlDoc.PresentationPart.Presentation.CustomerDataList != null) { // Sequence matters: http://www.schemacentral.com/sc/ooxml/e-p_custDataLst-1.html if (openXmlDoc.PresentationPart.Presentation.CustomerDataList.Count() > 0) { openXmlDoc.PresentationPart.Presentation.CustomerDataList.InsertBefore(customerData, openXmlDoc.PresentationPart.Presentation.CustomerDataList.FirstChild); } else { openXmlDoc.PresentationPart.Presentation.CustomerDataList.Append(customerData); } } else { CustomerDataList customerDataList = new CustomerDataList(); customerDataList.Append(customerData); // Sequence matters: http://www.schemacentral.com/sc/ooxml/e-p_presentation.html if (openXmlDoc.PresentationPart.Presentation.Kinsoku != null) { openXmlDoc.PresentationPart.Presentation.InsertBefore(customerDataList, openXmlDoc.PresentationPart.Presentation.Kinsoku); } else if (openXmlDoc.PresentationPart.Presentation.DefaultTextStyle != null) { openXmlDoc.PresentationPart.Presentation.InsertBefore(customerDataList, openXmlDoc.PresentationPart.Presentation.DefaultTextStyle); } else if (openXmlDoc.PresentationPart.Presentation.ModificationVerifier != null) { openXmlDoc.PresentationPart.Presentation.InsertBefore(customerDataList, openXmlDoc.PresentationPart.Presentation.ModificationVerifier); } else if (openXmlDoc.PresentationPart.Presentation.PresentationExtensionList != null) { openXmlDoc.PresentationPart.Presentation.InsertBefore(customerDataList, openXmlDoc.PresentationPart.Presentation.PresentationExtensionList); } else { openXmlDoc.PresentationPart.Presentation.Append(customerDataList); } } } }
public static void GenerateCustomXmlPropertiesPart2Content(CustomXmlPropertiesPart customXmlPropertiesPart2) { var dataStoreItem2 = new Ds.DataStoreItem { ItemId = "{F775187F-6448-4D29-88AA-E6D4EE8DAECF}" }; dataStoreItem2.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); var schemaReferences2 = new Ds.SchemaReferences(); var schemaReference3 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/office/2006/metadata/contentType" }; var schemaReference4 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/office/2006/metadata/properties/metaAttributes" }; var schemaReference5 = new Ds.SchemaReference { Uri = "http://www.w3.org/2001/XMLSchema" }; var schemaReference6 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/office/2006/metadata/properties" }; var schemaReference7 = new Ds.SchemaReference { Uri = "4fc81810-4f98-4e7e-b20e-7b2a690091c4" }; var schemaReference8 = new Ds.SchemaReference { Uri = "067d236f-0129-4702-b692-531fc2f871d2" }; var schemaReference9 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/office/2006/documentManagement/types" }; var schemaReference10 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/office/infopath/2007/PartnerControls" }; var schemaReference11 = new Ds.SchemaReference { Uri = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties" }; var schemaReference12 = new Ds.SchemaReference { Uri = "http://purl.org/dc/elements/1.1/" }; var schemaReference13 = new Ds.SchemaReference { Uri = "http://purl.org/dc/terms/" }; var schemaReference14 = new Ds.SchemaReference { Uri = "http://schemas.microsoft.com/internal/obd" }; schemaReferences2.Append(schemaReference3); schemaReferences2.Append(schemaReference4); schemaReferences2.Append(schemaReference5); schemaReferences2.Append(schemaReference6); schemaReferences2.Append(schemaReference7); schemaReferences2.Append(schemaReference8); schemaReferences2.Append(schemaReference9); schemaReferences2.Append(schemaReference10); schemaReferences2.Append(schemaReference11); schemaReferences2.Append(schemaReference12); schemaReferences2.Append(schemaReference13); schemaReferences2.Append(schemaReference14); dataStoreItem2.Append(schemaReferences2); customXmlPropertiesPart2.DataStoreItem = dataStoreItem2; }
public static void GenerateCustomXmlPropertiesPart1Content(CustomXmlPropertiesPart customXmlPropertiesPart1) { Ds.DataStoreItem dataStoreItem1 = new Ds.DataStoreItem() { ItemId = "{64AC9C18-D41E-498F-B0D7-25FEAA2ECF4F}" }; dataStoreItem1.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); Ds.SchemaReferences schemaReferences1 = new Ds.SchemaReferences(); Ds.SchemaReference schemaReference1 = new Ds.SchemaReference() { Uri = "http://purl.org/dc/terms/" }; Ds.SchemaReference schemaReference2 = new Ds.SchemaReference() { Uri = "4fc81810-4f98-4e7e-b20e-7b2a690091c4" }; Ds.SchemaReference schemaReference3 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/documentManagement/types" }; Ds.SchemaReference schemaReference4 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/infopath/2007/PartnerControls" }; Ds.SchemaReference schemaReference5 = new Ds.SchemaReference() { Uri = "http://purl.org/dc/elements/1.1/" }; Ds.SchemaReference schemaReference6 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/metadata/properties" }; Ds.SchemaReference schemaReference7 = new Ds.SchemaReference() { Uri = "067d236f-0129-4702-b692-531fc2f871d2" }; Ds.SchemaReference schemaReference8 = new Ds.SchemaReference() { Uri = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties" }; Ds.SchemaReference schemaReference9 = new Ds.SchemaReference() { Uri = "http://www.w3.org/XML/1998/namespace" }; Ds.SchemaReference schemaReference10 = new Ds.SchemaReference() { Uri = "http://purl.org/dc/dcmitype/" }; schemaReferences1.Append(schemaReference1); schemaReferences1.Append(schemaReference2); schemaReferences1.Append(schemaReference3); schemaReferences1.Append(schemaReference4); schemaReferences1.Append(schemaReference5); schemaReferences1.Append(schemaReference6); schemaReferences1.Append(schemaReference7); schemaReferences1.Append(schemaReference8); schemaReferences1.Append(schemaReference9); schemaReferences1.Append(schemaReference10); dataStoreItem1.Append(schemaReferences1); customXmlPropertiesPart1.DataStoreItem = dataStoreItem1; }
public static void GenerateCustomXmlPropertiesPart2Content(CustomXmlPropertiesPart customXmlPropertiesPart2) { Ds.DataStoreItem dataStoreItem2 = new Ds.DataStoreItem() { ItemId = "{712D5C48-63A0-44E3-B76A-BF5D263C6E7E}" }; dataStoreItem2.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"); Ds.SchemaReferences schemaReferences2 = new Ds.SchemaReferences(); Ds.SchemaReference schemaReference11 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/metadata/contentType" }; Ds.SchemaReference schemaReference12 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/metadata/properties/metaAttributes" }; Ds.SchemaReference schemaReference13 = new Ds.SchemaReference() { Uri = "http://www.w3.org/2001/XMLSchema" }; Ds.SchemaReference schemaReference14 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/metadata/properties" }; Ds.SchemaReference schemaReference15 = new Ds.SchemaReference() { Uri = "4fc81810-4f98-4e7e-b20e-7b2a690091c4" }; Ds.SchemaReference schemaReference16 = new Ds.SchemaReference() { Uri = "067d236f-0129-4702-b692-531fc2f871d2" }; Ds.SchemaReference schemaReference17 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/2006/documentManagement/types" }; Ds.SchemaReference schemaReference18 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/office/infopath/2007/PartnerControls" }; Ds.SchemaReference schemaReference19 = new Ds.SchemaReference() { Uri = "http://schemas.openxmlformats.org/package/2006/metadata/core-properties" }; Ds.SchemaReference schemaReference20 = new Ds.SchemaReference() { Uri = "http://purl.org/dc/elements/1.1/" }; Ds.SchemaReference schemaReference21 = new Ds.SchemaReference() { Uri = "http://purl.org/dc/terms/" }; Ds.SchemaReference schemaReference22 = new Ds.SchemaReference() { Uri = "http://schemas.microsoft.com/internal/obd" }; schemaReferences2.Append(schemaReference11); schemaReferences2.Append(schemaReference12); schemaReferences2.Append(schemaReference13); schemaReferences2.Append(schemaReference14); schemaReferences2.Append(schemaReference15); schemaReferences2.Append(schemaReference16); schemaReferences2.Append(schemaReference17); schemaReferences2.Append(schemaReference18); schemaReferences2.Append(schemaReference19); schemaReferences2.Append(schemaReference20); schemaReferences2.Append(schemaReference21); schemaReferences2.Append(schemaReference22); dataStoreItem2.Append(schemaReferences2); customXmlPropertiesPart2.DataStoreItem = dataStoreItem2; }
/// <summary> /// Loads the DOM from the CustomXmlPropertiesPart. /// </summary> /// <param name="openXmlPart">Specifies the part to be loaded.</param> public void Load(CustomXmlPropertiesPart openXmlPart) { LoadFromPart(openXmlPart); }