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


C# WordprocessingDocument.AddMainDocumentPart方法代码示例

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


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

示例1: AppendAltChunk

		// 05/12/2011   Add ability to append chunks. 
		// http://blogs.msdn.com/b/ericwhite/archive/2008/10/27/how-to-use-altchunk-for-document-assembly.aspx
		public static void AppendAltChunk(WordprocessingDocument docx, int nID, byte[] byChunk)
		{
			string altChunkId = "AltChunkId" + nID.ToString();
			MainDocumentPart mainPart = docx.MainDocumentPart;
			if ( mainPart == null )
			{
				mainPart = docx.AddMainDocumentPart();
				mainPart.AddNewPart<WebSettingsPart>("rId3");
				mainPart.AddNewPart<DocumentSettingsPart>("rId2");
				mainPart.AddNewPart<StyleDefinitionsPart>("rId1");
				mainPart.AddNewPart<ThemePart>("rId5");
				mainPart.AddNewPart<FontTablePart>("rId4");
				mainPart.Document = new Document();
				mainPart.Document.Body = new Body();
			}
			AlternativeFormatImportPart chunk = mainPart.AddAlternativeFormatImportPart(AlternativeFormatImportPartType.WordprocessingML, altChunkId);
			using ( MemoryStream stmChunk = new MemoryStream() )
			{
				stmChunk.Write(byChunk, 0, byChunk.Length);
				stmChunk.Seek(0, SeekOrigin.Begin);
				chunk.FeedData(stmChunk);
			}
			AltChunk altChunk = new AltChunk();
			altChunk.Id = altChunkId;
			mainPart.Document.Body.InsertAt<AltChunk>(altChunk, mainPart.Document.Body.Elements().Count());
			//mainPart.Document.Body.InsertAfter(altChunk, mainPart.Document.Body.Elements<Paragraph>().Last());
		}
开发者ID:huamouse,项目名称:Taoqi,代码行数:29,代码来源:DocumentBuilder.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);

			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

示例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);

            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

示例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)
        {
            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

示例6: CreateDocument

 internal WordprocessingDocument CreateDocument(String fileName)
 {
     docxFile = WordprocessingDocument.Create(fileName, WordprocessingDocumentType.Document);
     mainPart = docxFile.AddMainDocumentPart();
     docxFile.MainDocumentPart.Document = new DocumentFormat.OpenXml.Wordprocessing.Document(new Body());
     body = docxFile.MainDocumentPart.Document.Body;
     return docxFile;
 }
开发者ID:amilasurendra,项目名称:pdf-generator,代码行数:8,代码来源:DocumentPackager.cs

示例7: CreateDocX

        public static void CreateDocX(string md, string docName)
        {
            package = WordprocessingDocument.Create(docName, WordprocessingDocumentType.Document);
            package.AddMainDocumentPart();
            package.MainDocumentPart.Document = new Document();

            Body body = MarkdownToDocBody(md);
            SaveDocX(body, docName);
        }
开发者ID:sambeaven,项目名称:MarkdownToOpenXML,代码行数:9,代码来源:MarkdownToOpenXML.cs

示例8: DocxDocument

        ///<summary>
        /// Creates new instance of DocxDocument from scratch
        ///</summary>
        public DocxDocument()
        {
            _documentStream = new MemoryStream();

            _wordDocument = WordprocessingDocument.Create(_documentStream, WordprocessingDocumentType.Document, true);
            _wordDocument.AddMainDocumentPart();
            _wordDocument.MainDocumentPart.Document = new Document(new Body());

            var sdtElements = _wordDocument.MainDocumentPart.Document.Body.Descendants<SdtElement>();
            _fields = new FieldsCollection(sdtElements);
        }
开发者ID:AlexanderByndyu,项目名称:TabulaRasa,代码行数:14,代码来源:DocxDocument.cs

示例9: DocumentBuilder

        public DocumentBuilder(WordprocessingDocument document, bool isEmptyDocument)
        {
            this.document = document;

            if (isEmptyDocument)
            {
                main = document.AddMainDocumentPart();
                main.Document = new Document();
                body = main.Document.AppendChild(new Body());

                InsertParagraph();
            }
            else
            {
                throw new Exception("Manipulating existing documents is not supported.");
            }
        }
开发者ID:vc3,项目名称:ExoMerge,代码行数:17,代码来源:DocumentBuilder.cs

示例10: DocxParser

        public DocxParser(ContentFile file)
        {
            parsedFile = file;
            path = Path.GetTempPath() + Path.DirectorySeparatorChar + "tmp-" + DateTime.Now.Ticks.ToString();

            doc = WordprocessingDocument.Create(path, DocumentFormat.OpenXml.WordprocessingDocumentType.Document);

            var mainPart = doc.AddMainDocumentPart();
            var paragraph = new Paragraph(new Run(new Text(file.contentText)));

            SetMetadata(MetadataType.Author, file.Metadata[MetadataType.Author]);
            SetMetadata(MetadataType.Description, file.Metadata[MetadataType.Author]);
            SetMetadata(MetadataType.Language, file.Metadata[MetadataType.Author]);
            SetMetadata(MetadataType.Subject, file.Metadata[MetadataType.Author]);
            SetMetadata(MetadataType.Title, file.Metadata[MetadataType.Author]);
            SetMetadata(MetadataType.Type, file.Metadata[MetadataType.Author]);
        }
开发者ID:sashaMilka,项目名称:MultiReader,代码行数:17,代码来源:DocxParser.cs

示例11: 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

示例12: 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

示例13: 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

示例14: GetDocumentBody

        /// <summary>
        /// Populates the processing document and gets its body element.
        /// </summary>
        /// <returns>Body of the document that will hold the dictionary.</returns>
        private Body GetDocumentBody(WordprocessingDocument processingDocument)
        {
            // Create a MainDocumentPart instance
            MainDocumentPart mainDocPart = processingDocument.AddMainDocumentPart();
            mainDocPart.Document = new Document();

            // Create a Document instance
            Document document = mainDocPart.Document;

            // Create a Body instance
            Body body = document.AppendChild(new Body());


            // Create 2 columns for page layout
            SectionProperties sectionProperties = new SectionProperties();
            Columns columns = new Columns() { ColumnCount = 2 };
            columns.Separator = OnOffValue.FromBoolean(true);
            sectionProperties.Append(columns);

            body.Append(sectionProperties);

            return body;
        }
开发者ID:KnightWhoSaysNi,项目名称:German-Dictionary,代码行数:27,代码来源:MainViewModel.cs

示例15: BuildDocument

 private static void BuildDocument(List<Source> sources, WordprocessingDocument output)
 {
     // This list is used to eliminate duplicate images
     List<ImageData> images = new List<ImageData>();
     output.AddMainDocumentPart();
     XDocument mainPart = output.MainDocumentPart.GetXDocument();
     mainPart.Add(new XElement(ns + "document", ns_attrs, new XElement(ns + "body")));
     if (sources.Count > 0)
     {
         output.CopyStartingParts(sources[0].Document, images);
         bool lastKeepSections = false;
         foreach (Source source in sources)
         {
             output.AppendDocument(source.Document, source.Contents, source.KeepSections, lastKeepSections, images);
             lastKeepSections = source.KeepSections;
         }
     }
 }
开发者ID:huamouse,项目名称:Taoqi,代码行数:18,代码来源:DocumentBuilder.cs


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