当前位置: 首页>>代码示例>>C#>>正文


C# WordprocessingDocument.AddNewPart方法代码示例

本文整理汇总了C#中WordprocessingDocument.AddNewPart方法的典型用法代码示例。如果您正苦于以下问题:C# WordprocessingDocument.AddNewPart方法的具体用法?C# WordprocessingDocument.AddNewPart怎么用?C# WordprocessingDocument.AddNewPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WordprocessingDocument的用法示例。


在下文中一共展示了WordprocessingDocument.AddNewPart方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId8");
            GenerateFontTablePart1Content(fontTablePart1);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId3");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId2");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId9");
            GenerateThemePart1Content(themePart1);

            mainDocumentPart1.AddHyperlinkRelationship(new System.Uri("mailto:[email protected]", System.UriKind.Absolute), true, "rId7");
            mainDocumentPart1.AddHyperlinkRelationship(new System.Uri("http://www.shivam.com", System.UriKind.Absolute), true, "rId6");
            mainDocumentPart1.AddHyperlinkRelationship(new System.Uri("mailto:[email protected]", System.UriKind.Absolute), true, "rId5");
            mainDocumentPart1.AddHyperlinkRelationship(new System.Uri("http://www.google.com", System.UriKind.Absolute), true, "rId4");
            SetPackageProperties(document);
        }
开发者ID:vijaypaliwal,项目名称:locum,代码行数:30,代码来源:Generateinvoice.cs

示例2: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId2");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            CustomXmlPart customXmlPart1 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId1");
            GenerateCustomXmlPart1Content(customXmlPart1);

            CustomXmlPropertiesPart customXmlPropertiesPart1 = customXmlPart1.AddNewPart<CustomXmlPropertiesPart>("rId1");
            GenerateCustomXmlPropertiesPart1Content(customXmlPropertiesPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId6");
            GenerateThemePart1Content(themePart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId5");
            GenerateFontTablePart1Content(fontTablePart1);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId4");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            SetPackageProperties(document);
        }
开发者ID:CGHill,项目名称:Hard-To-Find,代码行数:32,代码来源:InvoiceCreator.cs

示例3: CreateParts

		// Adds child parts and generates content of the specified part.
		private void CreateParts(WordprocessingDocument document)
		{
			ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
			GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

			MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
			GenerateMainDocumentPart1Content(mainDocumentPart1);

			DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3");
			GenerateDocumentSettingsPart1Content(documentSettingsPart1);

			StylesWithEffectsPart stylesWithEffectsPart1 = mainDocumentPart1.AddNewPart<StylesWithEffectsPart>("rId2");
			GenerateStylesWithEffectsPart1Content(stylesWithEffectsPart1);

			StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1");
			GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

			ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId6");
			GenerateThemePart1Content(themePart1);

			FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId5");
			GenerateFontTablePart1Content(fontTablePart1);

			WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId4");
			GenerateWebSettingsPart1Content(webSettingsPart1);

		}
开发者ID:stevesloka,项目名称:bvcms,代码行数:28,代码来源:EmployerAddress.cs

示例4: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1);

            StylesWithEffectsPart stylesWithEffectsPart1 = mainDocumentPart1.AddNewPart<StylesWithEffectsPart>("rId3");
            GenerateStylesWithEffectsPart1Content(stylesWithEffectsPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId7");
            GenerateThemePart1Content(themePart1);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId2");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            CustomXmlPart customXmlPart1 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId1");
            GenerateCustomXmlPart1Content(customXmlPart1);

            CustomXmlPropertiesPart customXmlPropertiesPart1 = customXmlPart1.AddNewPart<CustomXmlPropertiesPart>("rId1");
            GenerateCustomXmlPropertiesPart1Content(customXmlPropertiesPart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId6");
            GenerateFontTablePart1Content(fontTablePart1);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId5");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId4");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            documentSettingsPart1.AddExternalRelationship("http://schemas.openxmlformats.org/officeDocument/2006/relationships/attachedTemplate", new System.Uri("file:///D:\\Downloads\\FamilyMergeDoc%20(2).dotx", System.UriKind.Absolute), "rId1");
        }
开发者ID:stevesloka,项目名称:bvcms,代码行数:35,代码来源:FamilyDir.cs

示例5: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document, objPatientContract obj)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1, obj);

            FooterPart footerPart1 = mainDocumentPart1.AddNewPart<FooterPart>("rId8");
            GenerateFooterPart1Content(footerPart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            HeaderPart headerPart1 = mainDocumentPart1.AddNewPart<HeaderPart>("rId7");
            GenerateHeaderPart1Content(headerPart1);

            StylesWithEffectsPart stylesWithEffectsPart1 = mainDocumentPart1.AddNewPart<StylesWithEffectsPart>("rId2");
            GenerateStylesWithEffectsPart1Content(stylesWithEffectsPart1);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            EndnotesPart endnotesPart1 = mainDocumentPart1.AddNewPart<EndnotesPart>("rId6");
            GenerateEndnotesPart1Content(endnotesPart1);

            FootnotesPart footnotesPart1 = mainDocumentPart1.AddNewPart<FootnotesPart>("rId5");
            GenerateFootnotesPart1Content(footnotesPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId10");
            GenerateThemePart1Content(themePart1);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId4");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId9");
            GenerateFontTablePart1Content(fontTablePart1);

            SetPackageProperties(document);
        }
开发者ID:rymbln,项目名称:Spec_Soft,代码行数:41,代码来源:GeneratedPatientContract.cs

示例6: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId8");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            FooterPart footerPart1 = mainDocumentPart1.AddNewPart<FooterPart>("rId13");
            GenerateFooterPart1Content(footerPart1);

            footerPart1.AddHyperlinkRelationship(new System.Uri("http://bjcis/sites/techservices/Informational%20Documents/Forms/AllItems.aspx", System.UriKind.Absolute), true, "rId2");
            footerPart1.AddHyperlinkRelationship(new System.Uri("http://bjcis/sites/techservices/Informational%20Documents/BJC%20IS%20Tech%20Management%20Standards.pdf", System.UriKind.Absolute), true, "rId1");
            CustomXmlPart customXmlPart1 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId3");
            GenerateCustomXmlPart1Content(customXmlPart1);

            CustomXmlPropertiesPart customXmlPropertiesPart1 = customXmlPart1.AddNewPart<CustomXmlPropertiesPart>("rId1");
            GenerateCustomXmlPropertiesPart1Content(customXmlPropertiesPart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId7");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            HeaderPart headerPart1 = mainDocumentPart1.AddNewPart<HeaderPart>("rId12");
            GenerateHeaderPart1Content(headerPart1);

            ImagePart imagePart1 = headerPart1.AddNewPart<ImagePart>("image/png", "rId1");
            GenerateImagePart1Content(imagePart1);

            CustomXmlPart customXmlPart2 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId2");
            GenerateCustomXmlPart2Content(customXmlPart2);

            CustomXmlPropertiesPart customXmlPropertiesPart2 = customXmlPart2.AddNewPart<CustomXmlPropertiesPart>("rId1");
            GenerateCustomXmlPropertiesPart2Content(customXmlPropertiesPart2);

            CustomXmlPart customXmlPart3 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId1");
            GenerateCustomXmlPart3Content(customXmlPart3);

            CustomXmlPropertiesPart customXmlPropertiesPart3 = customXmlPart3.AddNewPart<CustomXmlPropertiesPart>("rId1");
            GenerateCustomXmlPropertiesPart3Content(customXmlPropertiesPart3);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId6");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            ImagePart imagePart2 = mainDocumentPart1.AddNewPart<ImagePart>("image/x-emf", "rId11");
            GenerateImagePart2Content(imagePart2);

            NumberingDefinitionsPart numberingDefinitionsPart1 = mainDocumentPart1.AddNewPart<NumberingDefinitionsPart>("rId5");
            GenerateNumberingDefinitionsPart1Content(numberingDefinitionsPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId15");
            GenerateThemePart1Content(themePart1);

            EndnotesPart endnotesPart1 = mainDocumentPart1.AddNewPart<EndnotesPart>("rId10");
            GenerateEndnotesPart1Content(endnotesPart1);

            CustomXmlPart customXmlPart4 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId4");
            GenerateCustomXmlPart4Content(customXmlPart4);

            CustomXmlPropertiesPart customXmlPropertiesPart4 = customXmlPart4.AddNewPart<CustomXmlPropertiesPart>("rId1");
            GenerateCustomXmlPropertiesPart4Content(customXmlPropertiesPart4);

            FootnotesPart footnotesPart1 = mainDocumentPart1.AddNewPart<FootnotesPart>("rId9");
            GenerateFootnotesPart1Content(footnotesPart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId14");
            GenerateFontTablePart1Content(fontTablePart1);

            CustomFilePropertiesPart customFilePropertiesPart1 = document.AddNewPart<CustomFilePropertiesPart>("rId4");
            GenerateCustomFilePropertiesPart1Content(customFilePropertiesPart1);

            SetPackageProperties(document);
        }
开发者ID:RoryNorman,项目名称:PowerShell,代码行数:76,代码来源:Program.cs

示例7: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            NumberingDefinitionsPart numberingDefinitionsPart1 = mainDocumentPart1.AddNewPart<NumberingDefinitionsPart>("rId1");

            GenerateMainDocumentPart1Content(mainDocumentPart1);

            ImagePart imagePart1 = mainDocumentPart1.AddNewPart<ImagePart>("image/gif", "rId8");
            GenerateImagePart1Content(imagePart1);

            FooterPart footerPart1 = mainDocumentPart1.AddNewPart<FooterPart>("rId13");
            GenerateFooterPart1Content(footerPart1);

            ImagePart imagePart2 = footerPart1.AddNewPart<ImagePart>("image/gif", "rId2");
            GenerateImagePart2Content(imagePart2);

            ImagePart imagePart3 = footerPart1.AddNewPart<ImagePart>("image/gif", "rId1");
            GenerateImagePart3Content(imagePart3);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            documentSettingsPart1.AddExternalRelationship("http://schemas.openxmlformats.org/officeDocument/2006/relationships/attachedTemplate", new System.Uri("file:///C:\\Documents%20and%20Settings\\ppelletier.RUSSELL\\Application%20Data\\Microsoft\\Templates\\RADAR%20Template.dot", System.UriKind.Absolute), "rId1");
            ImagePart imagePartOverallEval1 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartOverallEval1");
            GenerateImagePartOverallEvalContent(imagePartOverallEval1, imagePartOverallEval1Data);

            ImagePart imagePartOverallEval2 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartOverallEval2");
            GenerateImagePartOverallEvalContent(imagePartOverallEval2, imagePartOverallEval2Data);

            ImagePart imagePartOverallEval3 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartOverallEval3");
            GenerateImagePartOverallEvalContent(imagePartOverallEval3, imagePartOverallEval3Data);

            ImagePart imagePartOverallEval4 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartOverallEval4");
            GenerateImagePartOverallEvalContent(imagePartOverallEval4, imagePartOverallEval4Data);

            HeaderPart headerPart1 = mainDocumentPart1.AddNewPart<HeaderPart>("rId12");
            GenerateHeaderPart1Content(headerPart1);

            ImagePart imagePart5 = headerPart1.AddNewPart<ImagePart>("image/png", "rId1");
            GenerateImagePart5Content(imagePart5);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId2");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            GenerateNumberingDefinitionsPart1Content(numberingDefinitionsPart1);

            EndnotesPart endnotesPart1 = mainDocumentPart1.AddNewPart<EndnotesPart>("rId6");
            GenerateEndnotesPart1Content(endnotesPart1);

            FooterPart footerPart2 = mainDocumentPart1.AddNewPart<FooterPart>("rId11");
            GenerateFooterPart2Content(footerPart2);

            footerPart2.AddPart(imagePart2, "rId2");

            footerPart2.AddPart(imagePart3, "rId1");

            FootnotesPart footnotesPart1 = mainDocumentPart1.AddNewPart<FootnotesPart>("rId5");
            GenerateFootnotesPart1Content(footnotesPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId15");
            GenerateThemePart1Content(themePart1);

            HeaderPart headerPart2 = mainDocumentPart1.AddNewPart<HeaderPart>("rId10");
            GenerateHeaderPart2Content(headerPart2);

            ImagePart imagePart6 = headerPart2.AddNewPart<ImagePart>("image/jpeg", "rId1");
            GenerateImagePart6Content(imagePart6);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId4");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            ImagePart imagePartTopicRank1 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartTopicRank1");
            GenerateImagePartTopicRankContent(imagePartTopicRank1, imagePartTopicRank1Data);

            ImagePart imagePartTopicRank2 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartTopicRank2");
            GenerateImagePartTopicRankContent(imagePartTopicRank2, imagePartTopicRank2Data);

            ImagePart imagePartTopicRank3 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartTopicRank3");
            GenerateImagePartTopicRankContent(imagePartTopicRank3, imagePartTopicRank3Data);

            ImagePart imagePartTopicRank4 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartTopicRank4");
            GenerateImagePartTopicRankContent(imagePartTopicRank4, imagePartTopicRank4Data);

            ImagePart imagePartTopicRank5 = mainDocumentPart1.AddNewPart<ImagePart>("image/png", "rIdImgPartTopicRank5");
            GenerateImagePartTopicRankContent(imagePartTopicRank5, imagePartTopicRank5Data);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId14");
            GenerateFontTablePart1Content(fontTablePart1);

            SetPackageProperties(document);
        }
开发者ID:julienblin,项目名称:RadarPOC,代码行数:95,代码来源:OpinionDocument-GeneratedOpenXml.cs

示例8: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document, int reportId)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();

            List<customSection> objArray = new DocxReportMaker().GenerateReport(mainDocumentPart1, reportId);

            int counter = 1;

            // Add external image link
            foreach (customSection item in objArray)
            {
                if (item.Image != null)
                {
                    item.Image.Link = "image" + counter.ToString();
                    counter++;
                    mainDocumentPart1.AddExternalRelationship("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
                        new System.Uri(item.Image.Url, System.UriKind.Absolute), item.Image.Link);
                }
            }

            //mainDocumentPart1.AddExternalRelationship("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
            //    new System.Uri("http://www.montereybayaquarium.org/storage/promotions/200x125/g_sfw_inthenews.gif", System.UriKind.Absolute), "image1");

            // main document area
            GenerateMainDocumentPart1Content(mainDocumentPart1, objArray);

            WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId3");
            GenerateWebSettingsPart1Content(webSettingsPart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId2");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            //StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1");
            //GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId5");
            GenerateThemePart1Content(themePart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId4");
            GenerateFontTablePart1Content(fontTablePart1);

            SetPackageProperties(document);
        }
开发者ID:joyoon,项目名称:mb,代码行数:47,代码来源:Generator.cs

示例9: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            object oMissing = System.Reflection.Missing.Value;

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1);

            ChartPart chartPart1 = mainDocumentPart1.AddNewPart<ChartPart>("rId13");
            GenerateChartPart1Content(chartPart1);

            EmbeddedPackagePart embeddedPackagePart1 = chartPart1.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId1");

            GenerateEmbeddedPackagePart1Content(embeddedPackagePart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);

            ChartPart chartPart2 = mainDocumentPart1.AddNewPart<ChartPart>("rId7");
            GenerateChartPart2Content(chartPart2);

            EmbeddedPackagePart embeddedPackagePart2 = chartPart2.AddNewPart<EmbeddedPackagePart>("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "rId1");
            GenerateEmbeddedPackagePart2Content(embeddedPackagePart2);

            using (Stream str = embeddedPackagePart2.GetStream())
            using (MemoryStream ms = new MemoryStream())
            {
                CopyStream(str, ms);
                using (SpreadsheetDocument spreadsheetDoc =
                    SpreadsheetDocument.Open(ms, true))
                {
                    // Update data in spreadsheet
                    // Find first worksheet
                    ss.Sheet ws = (ss.Sheet)spreadsheetDoc.WorkbookPart
                        .Workbook.Sheets
                        .FirstOrDefault();
                    string sheetId = ws.Id;

                    WorksheetPart wsp = (WorksheetPart)spreadsheetDoc
                        .WorkbookPart
                        .Parts
                        .Where(pt => pt.RelationshipId == sheetId)
                        .FirstOrDefault()
                        .OpenXmlPart;
                    ss.SheetData sd = wsp
                        .Worksheet
                        .Elements<ss.SheetData>()
                        .FirstOrDefault();
                    foreach (ss.Row tsd in sd.Elements<ss.Row>())
                    {

                        if (tsd.Elements<ss.Cell>().Count()> 1)
                        {
                            ss.Cell cell1 = tsd.Elements<ss.Cell>()
                                .ElementAt(1);
                            if (cell1 != null)
                            {
                                ss.CellValue cell1value = cell1.Elements<ss.CellValue>().FirstOrDefault();
                                System.Console.WriteLine(cell1value.InnerText+cell1value.Text);
                                if (cell1value != null && !cell1value.InnerText.Equals("0"))
                                {
                                    cell1value.Text = "25";
                                }
                            }
                        }
                    }

                }
                // Write the modified memory stream back
                // into the embedded package part.
                System.Console.WriteLine(Getbase64String(ms));
                if(!embeddedPackagePart2Data.Equals(Getbase64String(ms)))
                    embeddedPackagePart2Data = Getbase64String(ms);
                ms.Close();

            }

            GenerateEmbeddedPackagePart2Content(embeddedPackagePart2);

            StylesWithEffectsPart stylesWithEffectsPart1 = mainDocumentPart1.AddNewPart<StylesWithEffectsPart>("rId2");
            GenerateStylesWithEffectsPart1Content(stylesWithEffectsPart1);

            ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId16");
            GenerateThemePart1Content(themePart1);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            EndnotesPart endnotesPart1 = mainDocumentPart1.AddNewPart<EndnotesPart>("rId6");
            GenerateEndnotesPart1Content(endnotesPart1);

            FootnotesPart footnotesPart1 = mainDocumentPart1.AddNewPart<FootnotesPart>("rId5");
            GenerateFootnotesPart1Content(footnotesPart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId15");
            GenerateFontTablePart1Content(fontTablePart1);

//.........这里部分代码省略.........
开发者ID:pradeepkumargali,项目名称:GenerateWord-OpenXML,代码行数:101,代码来源:GeneratedClass.cs

示例10: CreateParts

		// Adds child parts and generates content of the specified part.
		private void CreateParts(WordprocessingDocument document)
		{
			ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId3");
			GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

			MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
			GenerateMainDocumentPart1Content(mainDocumentPart1);

			FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId13");
			GenerateFontTablePart1Content(fontTablePart1);

			StylesWithEffectsPart stylesWithEffectsPart1 = mainDocumentPart1.AddNewPart<StylesWithEffectsPart>("rId3");
			GenerateStylesWithEffectsPart1Content(stylesWithEffectsPart1);

			EndnotesPart endnotesPart1 = mainDocumentPart1.AddNewPart<EndnotesPart>("rId7");
			GenerateEndnotesPart1Content(endnotesPart1);

			FooterPart footerPart1 = mainDocumentPart1.AddNewPart<FooterPart>("rId12");
			GenerateFooterPart1Content(footerPart1);

			StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId2");
			GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

			CustomXmlPart customXmlPart1 = mainDocumentPart1.AddNewPart<CustomXmlPart>("application/xml", "rId1");
			GenerateCustomXmlPart1Content(customXmlPart1);

			CustomXmlPropertiesPart customXmlPropertiesPart1 = customXmlPart1.AddNewPart<CustomXmlPropertiesPart>("rId1");
			GenerateCustomXmlPropertiesPart1Content(customXmlPropertiesPart1);

			FootnotesPart footnotesPart1 = mainDocumentPart1.AddNewPart<FootnotesPart>("rId6");
			GenerateFootnotesPart1Content(footnotesPart1);

			HeaderPart headerPart1 = mainDocumentPart1.AddNewPart<HeaderPart>("rId11");
			GenerateHeaderPart1Content(headerPart1);

			WebSettingsPart webSettingsPart1 = mainDocumentPart1.AddNewPart<WebSettingsPart>("rId5");
			GenerateWebSettingsPart1Content(webSettingsPart1);

			FooterPart footerPart2 = mainDocumentPart1.AddNewPart<FooterPart>("rId10");
			GenerateFooterPart2Content(footerPart2);

			DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId4");
			GenerateDocumentSettingsPart1Content(documentSettingsPart1);

			HeaderPart headerPart2 = mainDocumentPart1.AddNewPart<HeaderPart>("rId9");
			GenerateHeaderPart2Content(headerPart2);

			ThemePart themePart1 = mainDocumentPart1.AddNewPart<ThemePart>("rId14");
			GenerateThemePart1Content(themePart1);

		}
开发者ID:stevesloka,项目名称:bvcms,代码行数:52,代码来源:PictureDir.cs

示例11: CreateParts

        // Adds child parts and generates content of the specified part.
        private void CreateParts(WordprocessingDocument document)
        {
            
            ExtendedPart extendedPart1 = document.AddExtendedPart("http://schemas.openxmlformats.org/officedocument/2006/relationships/metadata/core-properties", "application/vnd.openxmlformats-package.core-properties+xml", "xml", "rId1");
            GenerateExtendedPart1Content(extendedPart1);

            ExtendedFilePropertiesPart extendedFilePropertiesPart1 = document.AddNewPart<ExtendedFilePropertiesPart>("rId2");
            GenerateExtendedFilePropertiesPart1Content(extendedFilePropertiesPart1);

            MainDocumentPart mainDocumentPart1 = document.AddMainDocumentPart();
            GenerateMainDocumentPart1Content(mainDocumentPart1);

            StyleDefinitionsPart styleDefinitionsPart1 = mainDocumentPart1.AddNewPart<StyleDefinitionsPart>("rId1");
            GenerateStyleDefinitionsPart1Content(styleDefinitionsPart1);

            FontTablePart fontTablePart1 = mainDocumentPart1.AddNewPart<FontTablePart>("rId2");
            GenerateFontTablePart1Content(fontTablePart1);

            DocumentSettingsPart documentSettingsPart1 = mainDocumentPart1.AddNewPart<DocumentSettingsPart>("rId3");
            GenerateDocumentSettingsPart1Content(documentSettingsPart1);
            TableRow tet = GenTab();
           // mainDocumentPart1.Document.Body.ChildElements.GetItem(1).Append(tet);
            mainDocumentPart1.Document.Body.ChildElements.GetItem(1).InsertAt(tet, 50);
            SetPackageProperties(document);
        }
开发者ID:test-oleg,项目名称:passport,代码行数:26,代码来源:Pass1.cs


注:本文中的WordprocessingDocument.AddNewPart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。