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


C# Document.Append方法代码示例

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


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

示例1: GenerateDocument

        public static Document GenerateDocument()
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            DocumentBackground documentBackground1 = new DocumentBackground() { Color = "FF0000" };

            V.Background background1 = new V.Background() { Id = "_x0000_s1025", BlackWhiteMode = Ovml.BlackAndWhiteModeValues.GrayScale, TargetScreenSize = Ovml.ScreenSizeValues.Sz1024x768 };
            V.Fill fill1 = new V.Fill() { Type = V.FillTypeValues.Frame, Title = "Wedding_EnclosureCards", Recolor = true, Color = "FF0000" };

            background1.Append(fill1);

            documentBackground1.Append(background1);

            Body body1 = new Body();

            Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "005F6C39", RsidRunAdditionDefault = "005F6C39" };
            BookmarkStart bookmarkStart1 = new BookmarkStart() { Name = "_GoBack", Id = "0" };
            BookmarkEnd bookmarkEnd1 = new BookmarkEnd() { Id = "0" };

            paragraph1.Append(bookmarkStart1);
            paragraph1.Append(bookmarkEnd1);

            SectionProperties sectionProperties1 = new SectionProperties() { RsidR = "005F6C39" };
            PageSize pageSize1 = new PageSize() { Width = (UInt32Value)12240U, Height = (UInt32Value)15840U };
            PageMargin pageMargin1 = new PageMargin() { Top = 1440, Right = (UInt32Value)1440U, Bottom = 1440, Left = (UInt32Value)1440U, Header = (UInt32Value)720U, Footer = (UInt32Value)720U, Gutter = (UInt32Value)0U };
            Columns columns1 = new Columns() { Space = "720" };
            DocGrid docGrid1 = new DocGrid() { LinePitch = 360 };

            sectionProperties1.Append(pageSize1);
            sectionProperties1.Append(pageMargin1);
            sectionProperties1.Append(columns1);
            sectionProperties1.Append(docGrid1);

            body1.Append(paragraph1);
            body1.Append(sectionProperties1);

            document1.Append(documentBackground1);
            document1.Append(body1);
            return document1;
        }
开发者ID:haizhixing126,项目名称:PYSConsole,代码行数:55,代码来源:WordGenerator.cs

示例2: TestReadBigDocument

        public void TestReadBigDocument()
        {
            MemoryStream ms = new MemoryStream();
            var writer = new BsonWriter(ms, new BsonDocumentDescriptor());

            Document expected = new Document();
            expected.Append("str", "test")
                .Append("int", 45)
                .Append("long", (long)46)
                .Append("num", 4.5)
                .Append("date",DateTime.Today)
                .Append("_id", new OidGenerator().Generate())
                .Append("code", new Code("return 1;"))
                .Append("subdoc", new Document().Append("a",1).Append("b",2))
                .Append("array", new String[]{"a","b","c","d"})
                .Append("codewscope", new CodeWScope("return 2;", new Document().Append("c",1)))
                .Append("binary", new Binary(new byte[]{0,1,2,3}))
                .Append("regex", new MongoRegex("[A-Z]"))
                .Append("minkey", MongoMinKey.Value)
                .Append("maxkey", MongoMaxKey.Value)
                .Append("symbol", new MongoSymbol("symbol"))
            ;
            writer.WriteObject(expected);
            writer.Flush();
            ms.Seek(0,SeekOrigin.Begin);

            BsonReader reader = new BsonReader(ms, new BsonDocumentBuilder());
            Document doc = reader.Read();

            Assert.IsNotNull(doc);
        }
开发者ID:ngocthanhit,项目名称:mongodb-csharp,代码行数:31,代码来源:TestBsonReader.cs

示例3: Insert

 static void Insert(Database db, string col, Document doc)
 {
     for(int i = 0; i < perTrial; i++){
         Document ins = new Document();
         doc.CopyTo(ins);
         ins.Append("x", i);
         db[col].Insert(ins);
     }
 }
开发者ID:tsibelman,项目名称:mongodb-csharp,代码行数:9,代码来源:Main.cs

示例4: TestGUID

        public void TestGUID()
        {
            Guid expected = Guid.NewGuid();

            Document source = new Document();
            source.Append("uuid", expected);

            Guid read = (Guid)(WriteAndRead(source)["uuid"]);

            Assert.AreEqual(expected, read, "UUID did not round trip right.");
        }
开发者ID:kvnsmth,项目名称:mongodb-csharp,代码行数:11,代码来源:TestRoundTrips.cs

示例5: Build

        public void Build(GeneralTree<IDirectoryTreeNode> features)
        {
            string filename = string.IsNullOrEmpty(this.configuration.SystemUnderTestName)
                                  ? "features.docx"
                                  : this.configuration.SystemUnderTestName + ".docx";
            string documentFileName = Path.Combine(this.configuration.OutputFolder.FullName, filename);
            if (File.Exists(documentFileName)) File.Delete(documentFileName);

            using (
                WordprocessingDocument wordProcessingDocument = WordprocessingDocument.Create(documentFileName,
                                                                                              WordprocessingDocumentType
                                                                                                  .Document))
            {
                MainDocumentPart mainDocumentPart = wordProcessingDocument.AddMainDocumentPart();
                this.wordStyleApplicator.AddStylesPartToPackage(wordProcessingDocument);
                this.wordStyleApplicator.AddStylesWithEffectsPartToPackage(wordProcessingDocument);
                this.wordFontApplicator.AddFontTablePartToPackage(wordProcessingDocument);
                var documentSettingsPart = mainDocumentPart.AddNewPart<DocumentSettingsPart>();
                documentSettingsPart.Settings = new Settings();
                this.wordHeaderFooterFormatter.ApplyHeaderAndFooter(wordProcessingDocument);

                var document = new Document();
                var body = new Body();
                document.Append(body);

                var actionVisitor = new ActionVisitor<IDirectoryTreeNode>(node =>
                                                                              {
                                                                                  var featureDirectoryTreeNode =
                                                                                      node as FeatureDirectoryTreeNode;
                                                                                  if (featureDirectoryTreeNode != null)
                                                                                  {
                                                                                      this.wordFeatureFormatter.Format(body,
                                                                                                                  featureDirectoryTreeNode);
                                                                                  }
                                                                              });

                features.AcceptVisitor(actionVisitor);

                mainDocumentPart.Document = document;
                mainDocumentPart.Document.Save();
            }

            // HACK - Add the table of contents
            using (WordprocessingDocument wordProcessingDocument = WordprocessingDocument.Open(documentFileName, true))
            {
                XElement firstPara = wordProcessingDocument
                    .MainDocumentPart
                    .GetXDocument()
                    .Descendants(W.p)
                    .FirstOrDefault();

                TocAdder.AddToc(wordProcessingDocument, firstPara, @"TOC \o '1-2' \h \z \u", null, 4);
            }
        }
开发者ID:timblinkbox,项目名称:pickles,代码行数:54,代码来源:WordDocumentationBuilder.cs

示例6: TestWrite

        public void TestWrite()
        {
            MemoryStream ms = new MemoryStream();

            InsertMessage im = new InsertMessage();
            im.FullCollectionName ="Tests.inserts";
            Document doc = new Document();
            Document[] docs = new Document[]{doc};
            doc.Append("a","a");
            doc.Append("b",1);
            im.Documents = docs;

            Assert.AreEqual(16,im.Header.MessageLength);

            BsonWriter2 bwriter = new BsonWriter2(ms);

            Assert.AreEqual(21,bwriter.CalculateSize(doc));

            im.Write(ms);

            Byte[] bytes = ms.ToArray();
            String hexdump = BitConverter.ToString(bytes);
            System.Console.WriteLine(hexdump);

            MemoryStream ms2 = new MemoryStream();
            BsonWriter b = new BsonWriter(ms2);
            b.Write(im.Header.MessageLength);
            b.Write(im.Header.RequestId);
            b.Write(im.Header.ResponseTo);
            b.Write((int)im.Header.OpCode);
            b.Write((int)0);
            b.Write(im.FullCollectionName);
            BsonDocument bdoc = BsonConvert.From(doc);
            bdoc.Write(b);

            b.Flush();
            String hexdump2 = BitConverter.ToString(ms2.ToArray());
            System.Console.WriteLine(hexdump2);
            Assert.AreEqual(hexdump2,hexdump);
            Assert.AreEqual(bytes.Length,im.Header.MessageLength);
        }
开发者ID:sdether,项目名称:mongodb-csharp,代码行数:41,代码来源:TestInsertMessage.cs

示例7: TestDateUTC

        public void TestDateUTC()
        {
            DateTime now = DateTime.UtcNow;

            Document source = new Document();
            source.Append("d",now);

            Document copy = WriteAndRead(source);
            DateTime then = (DateTime)copy["d"];

            Assert.AreEqual(now.Hour,then.Hour, "Date did not round trip right.");
        }
开发者ID:kvnsmth,项目名称:mongodb-csharp,代码行数:12,代码来源:TestRoundTrips.cs

示例8: TestDBRef

        public void TestDBRef()
        {
            Document source = new Document();
            source.Append("x",1).Append("ref",new DBRef("refs","ref1"));

            Document copy = WriteAndRead(source);

            Assert.IsTrue(copy.Contains("ref"));
            Assert.IsTrue(copy["ref"].GetType() == typeof(DBRef));

            DBRef sref = (DBRef)source["ref"];
            DBRef cref = (DBRef)copy["ref"];

            Assert.AreEqual(sref.Id, cref.Id);
        }
开发者ID:kvnsmth,项目名称:mongodb-csharp,代码行数:15,代码来源:TestRoundTrips.cs

示例9: TestDateUTC

        public void TestDateUTC()
        {
            DateTime now = DateTime.UtcNow;
            MemoryStream ms = new MemoryStream();
            BsonWriter writer = new BsonWriter(ms);

            Document source = new Document();
            source.Append("d",now);

            writer.Write(source);
            writer.Flush();
            ms.Seek(0,SeekOrigin.Begin);

            BsonReader reader = new BsonReader(ms);
            Document copy = reader.Read();

            DateTime then = (DateTime)copy["d"];

            Assert.AreEqual(now.Hour,then.Hour, "Date did not round trip right.");
        }
开发者ID:rodolfograve,项目名称:mongodb-csharp,代码行数:20,代码来源:TestRoundTrips.cs

示例10: TestDBRef

        public void TestDBRef()
        {
            MemoryStream ms = new MemoryStream();
            BsonWriter writer = new BsonWriter(ms);

            Document source = new Document();
            source.Append("x",1).Append("ref",new DBRef("refs","ref1"));

            writer.Write(source);
            writer.Flush();
            ms.Seek(0,SeekOrigin.Begin);

            BsonReader reader = new BsonReader(ms);
            Document copy = reader.Read();

            Assert.IsTrue(copy.Contains("ref"));
            Assert.IsTrue(copy["ref"].GetType() == typeof(DBRef));

            DBRef sref = (DBRef)source["ref"];
            DBRef cref = (DBRef)copy["ref"];

            Assert.AreEqual(sref.Id, cref.Id);
        }
开发者ID:rodolfograve,项目名称:mongodb-csharp,代码行数:23,代码来源:TestRoundTrips.cs

示例11: GenerateMainDocumentPart1Content

        // Generates content of mainDocumentPart1.
        private void GenerateMainDocumentPart1Content(MainDocumentPart mainDocumentPart1, objPatientContract obj)
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Body body1 = new Body();

            Paragraph paragraph1 = new Paragraph() { RsidParagraphAddition = "00900A10", RsidParagraphProperties = "00900A10", RsidRunAdditionDefault = "00900A10" };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            WidowControl widowControl1 = new WidowControl() { Val = false };
            AutoSpaceDE autoSpaceDE1 = new AutoSpaceDE() { Val = false };
            AutoSpaceDN autoSpaceDN1 = new AutoSpaceDN() { Val = false };
            AdjustRightIndent adjustRightIndent1 = new AdjustRightIndent() { Val = false };
            SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };

            ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            RunFonts runFonts1 = new RunFonts() { Ascii = "New Roman", HighAnsi = "New Roman", EastAsia = "New Roman", ComplexScript = "Times New Roman" };
            FontSize fontSize1 = new FontSize() { Val = "24" };
            FontSizeComplexScript fontSizeComplexScript1 = new FontSizeComplexScript() { Val = "24" };

            paragraphMarkRunProperties1.Append(runFonts1);
            paragraphMarkRunProperties1.Append(fontSize1);
            paragraphMarkRunProperties1.Append(fontSizeComplexScript1);

            paragraphProperties1.Append(widowControl1);
            paragraphProperties1.Append(autoSpaceDE1);
            paragraphProperties1.Append(autoSpaceDN1);
            paragraphProperties1.Append(adjustRightIndent1);
            paragraphProperties1.Append(spacingBetweenLines1);
            paragraphProperties1.Append(paragraphMarkRunProperties1);

            paragraph1.Append(paragraphProperties1);

            Paragraph paragraph2 = new Paragraph() { RsidParagraphAddition = "00900A10", RsidParagraphProperties = "00900A10", RsidRunAdditionDefault = "00900A10" };

            ParagraphProperties paragraphProperties2 = new ParagraphProperties();
            WidowControl widowControl2 = new WidowControl() { Val = false };
            AutoSpaceDE autoSpaceDE2 = new AutoSpaceDE() { Val = false };
            AutoSpaceDN autoSpaceDN2 = new AutoSpaceDN() { Val = false };
            AdjustRightIndent adjustRightIndent2 = new AdjustRightIndent() { Val = false };
            SpacingBetweenLines spacingBetweenLines2 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };

            ParagraphMarkRunProperties paragraphMarkRunProperties2 = new ParagraphMarkRunProperties();
            RunFonts runFonts2 = new RunFonts() { Ascii = "New Roman", HighAnsi = "New Roman", EastAsia = "New Roman", ComplexScript = "Times New Roman" };
            FontSize fontSize2 = new FontSize() { Val = "24" };
            FontSizeComplexScript fontSizeComplexScript2 = new FontSizeComplexScript() { Val = "24" };

            paragraphMarkRunProperties2.Append(runFonts2);
            paragraphMarkRunProperties2.Append(fontSize2);
            paragraphMarkRunProperties2.Append(fontSizeComplexScript2);

            paragraphProperties2.Append(widowControl2);
            paragraphProperties2.Append(autoSpaceDE2);
            paragraphProperties2.Append(autoSpaceDN2);
            paragraphProperties2.Append(adjustRightIndent2);
            paragraphProperties2.Append(spacingBetweenLines2);
            paragraphProperties2.Append(paragraphMarkRunProperties2);

            paragraph2.Append(paragraphProperties2);

            Paragraph paragraph3 = new Paragraph() { RsidParagraphAddition = "00900A10", RsidParagraphProperties = "00900A10", RsidRunAdditionDefault = "00900A10" };

            ParagraphProperties paragraphProperties3 = new ParagraphProperties();
            WidowControl widowControl3 = new WidowControl() { Val = false };
            AutoSpaceDE autoSpaceDE3 = new AutoSpaceDE() { Val = false };
            AutoSpaceDN autoSpaceDN3 = new AutoSpaceDN() { Val = false };
            AdjustRightIndent adjustRightIndent3 = new AdjustRightIndent() { Val = false };
            SpacingBetweenLines spacingBetweenLines3 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };
            Justification justification1 = new Justification() { Val = JustificationValues.Center };

            ParagraphMarkRunProperties paragraphMarkRunProperties3 = new ParagraphMarkRunProperties();
            RunFonts runFonts3 = new RunFonts() { Ascii = "Verdana", HighAnsi = "Verdana", EastAsia = "New Roman", ComplexScript = "Verdana" };
            FontSize fontSize3 = new FontSize() { Val = "20" };
            FontSizeComplexScript fontSizeComplexScript3 = new FontSizeComplexScript() { Val = "20" };

            paragraphMarkRunProperties3.Append(runFonts3);
            paragraphMarkRunProperties3.Append(fontSize3);
            paragraphMarkRunProperties3.Append(fontSizeComplexScript3);

            paragraphProperties3.Append(widowControl3);
            paragraphProperties3.Append(autoSpaceDE3);
            paragraphProperties3.Append(autoSpaceDN3);
            paragraphProperties3.Append(adjustRightIndent3);
            paragraphProperties3.Append(spacingBetweenLines3);
//.........这里部分代码省略.........
开发者ID:rymbln,项目名称:Spec_Soft,代码行数:101,代码来源:GeneratedPatientContract.cs

示例12: GenerateMainDocumentPart1Content

        // Generates content of mainDocumentPart1.
        private void GenerateMainDocumentPart1Content(MainDocumentPart mainDocumentPart1)
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Body body1 = new Body();

            Table table1 = new Table();

            TableProperties tableProperties1 = new TableProperties();
            TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" };
            TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto };

            TableBorders tableBorders1 = new TableBorders();
            TopBorder topBorder1 = new TopBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            LeftBorder leftBorder1 = new LeftBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            RightBorder rightBorder1 = new RightBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideHorizontalBorder insideHorizontalBorder1 = new InsideHorizontalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };
            InsideVerticalBorder insideVerticalBorder1 = new InsideVerticalBorder() { Val = BorderValues.None, Color = "auto", Size = (UInt32Value)0U, Space = (UInt32Value)0U };

            tableBorders1.Append(topBorder1);
            tableBorders1.Append(leftBorder1);
            tableBorders1.Append(bottomBorder1);
            tableBorders1.Append(rightBorder1);
            tableBorders1.Append(insideHorizontalBorder1);
            tableBorders1.Append(insideVerticalBorder1);
            TableLayout tableLayout1 = new TableLayout() { Type = TableLayoutValues.Fixed };

            TableCellMarginDefault tableCellMarginDefault1 = new TableCellMarginDefault();
            TableCellLeftMargin tableCellLeftMargin1 = new TableCellLeftMargin() { Width = 15, Type = TableWidthValues.Dxa };
            TableCellRightMargin tableCellRightMargin1 = new TableCellRightMargin() { Width = 15, Type = TableWidthValues.Dxa };

            tableCellMarginDefault1.Append(tableCellLeftMargin1);
            tableCellMarginDefault1.Append(tableCellRightMargin1);
            TableLook tableLook1 = new TableLook() { Val = "0000", FirstRow = false, LastRow = false, FirstColumn = false, LastColumn = false, NoHorizontalBand = false, NoVerticalBand = false };

            tableProperties1.Append(tableStyle1);
            tableProperties1.Append(tableWidth1);
            tableProperties1.Append(tableBorders1);
            tableProperties1.Append(tableLayout1);
            tableProperties1.Append(tableCellMarginDefault1);
            tableProperties1.Append(tableLook1);

            TableGrid tableGrid1 = new TableGrid();
            GridColumn gridColumn1 = new GridColumn() { Width = "3787" };
            GridColumn gridColumn2 = new GridColumn() { Width = "173" };
            GridColumn gridColumn3 = new GridColumn() { Width = "3787" };
            GridColumn gridColumn4 = new GridColumn() { Width = "173" };
            GridColumn gridColumn5 = new GridColumn() { Width = "3787" };

            tableGrid1.Append(gridColumn1);
            tableGrid1.Append(gridColumn2);
            tableGrid1.Append(gridColumn3);
            tableGrid1.Append(gridColumn4);
            tableGrid1.Append(gridColumn5);

            table1.Append(tableProperties1);
            table1.Append(tableGrid1);

            var n = 0;
            TableRow row = null;
            foreach(var p in q)
            {
                if (n % 3 == 0)
                {
                    if (row != null)
                        table1.Append(row);
                    row = EmployerAddressRow.AddPersonsRow();
                }
                row.AddPersonCell(p, addEmployer);
                if (n % 3 < 2)
                    row.AddSpacerCell();
                n++;
            }
            if (n % 3 != 0 && row != null)
                table1.Append(row);

            Paragraph paragraph54 = new Paragraph() { RsidParagraphMarkRevision = "005A43FA", RsidParagraphAddition = "005A43FA", RsidParagraphProperties = "005A43FA", RsidRunAdditionDefault = "005A43FA" };

            ParagraphProperties paragraphProperties54 = new ParagraphProperties();
            Indentation indentation54 = new Indentation() { Left = "95", Right = "95" };

            ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            Vanish vanish1 = new Vanish();
//.........这里部分代码省略.........
开发者ID:rossspoon,项目名称:bvcms,代码行数:101,代码来源:EmployerAddress.cs

示例13: GenerateMainDocumentPart1Content

        // Generates content of mainDocumentPart1.
        private void GenerateMainDocumentPart1Content(MainDocumentPart mainDocumentPart1)
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Body body1 = new Body();

            Paragraph paragraph1 = new Paragraph() { RsidParagraphMarkRevision = "00AB286F", RsidParagraphAddition = "00BC116E", RsidParagraphProperties = "00BC116E", RsidRunAdditionDefault = "00BC116E" };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();

            ParagraphBorders paragraphBorders1 = new ParagraphBorders();
            BottomBorder bottomBorder1 = new BottomBorder() { Val = BorderValues.Single, Color = "auto", Size = (UInt32Value)4U, Space = (UInt32Value)1U };

            paragraphBorders1.Append(bottomBorder1);

            ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            RunFonts runFonts1 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold1 = new Bold();
            FontSize fontSize1 = new FontSize() { Val = "26" };

            paragraphMarkRunProperties1.Append(runFonts1);
            paragraphMarkRunProperties1.Append(bold1);
            paragraphMarkRunProperties1.Append(fontSize1);

            paragraphProperties1.Append(paragraphBorders1);
            paragraphProperties1.Append(paragraphMarkRunProperties1);

            Run run1 = new Run() { RsidRunProperties = "00AB286F" };

            RunProperties runProperties1 = new RunProperties();
            RunFonts runFonts2 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold2 = new Bold();
            FontSize fontSize2 = new FontSize() { Val = "26" };

            runProperties1.Append(runFonts2);
            runProperties1.Append(bold2);
            runProperties1.Append(fontSize2);
            Text text1 = new Text();
            text1.Text = "Monthly Freight Report";

            run1.Append(runProperties1);
            run1.Append(text1);

            Run run2 = new Run() { RsidRunAddition = "00D26AC8" };

            RunProperties runProperties2 = new RunProperties();
            RunFonts runFonts3 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            Bold bold3 = new Bold();
            FontSize fontSize3 = new FontSize() { Val = "26" };

            runProperties2.Append(runFonts3);
            runProperties2.Append(bold3);
            runProperties2.Append(fontSize3);
            Text text2 = new Text();
            text2.Text = ": " + title;

            run2.Append(runProperties2);
            run2.Append(text2);

            paragraph1.Append(paragraphProperties1);
            paragraph1.Append(run1);
            paragraph1.Append(run2);

            Paragraph paragraph2 = new Paragraph() { RsidParagraphMarkRevision = "004C4FC4", RsidParagraphAddition = "00BC116E", RsidRunAdditionDefault = "00BC116E" };

            ParagraphProperties paragraphProperties2 = new ParagraphProperties();

            ParagraphMarkRunProperties paragraphMarkRunProperties2 = new ParagraphMarkRunProperties();
            RunFonts runFonts4 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };

            paragraphMarkRunProperties2.Append(runFonts4);

            paragraphProperties2.Append(paragraphMarkRunProperties2);

            paragraph2.Append(paragraphProperties2);

            Table table1 = new Table();

            TableProperties tableProperties1 = new TableProperties();
            TableStyle tableStyle1 = new TableStyle() { Val = "TableGrid" };
            TableWidth tableWidth1 = new TableWidth() { Width = "0", Type = TableWidthUnitValues.Auto };

            TableBorders tableBorders1 = new TableBorders();
//.........这里部分代码省略.........
开发者ID:CGHill,项目名称:Hard-To-Find,代码行数:101,代码来源:FreightReportCreator.cs

示例14: GenerateMainDocumentPart1Content

        // Generates content of mainDocumentPart1.
        private void GenerateMainDocumentPart1Content(MainDocumentPart mainDocumentPart1)
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Body body1 = new Body();

            Paragraph paragraph1 = new Paragraph() { RsidParagraphMarkRevision = "00570900", RsidParagraphAddition = "00082073", RsidParagraphProperties = "003627FC", RsidRunAdditionDefault = "003627FC" };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines1 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties1 = new ParagraphMarkRunProperties();
            RunFonts runFonts1 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize1 = new FontSize() { Val = "26" };

            paragraphMarkRunProperties1.Append(runFonts1);
            paragraphMarkRunProperties1.Append(fontSize1);

            paragraphProperties1.Append(spacingBetweenLines1);
            paragraphProperties1.Append(paragraphMarkRunProperties1);

            Paragraph paragraph2 = new Paragraph() { RsidParagraphMarkRevision = "00570900", RsidParagraphAddition = "003627FC", RsidParagraphProperties = "003627FC", RsidRunAdditionDefault = "003627FC" };

            ParagraphProperties paragraphProperties2 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines2 = new SpacingBetweenLines() { After = "0" };

            ParagraphMarkRunProperties paragraphMarkRunProperties2 = new ParagraphMarkRunProperties();
            RunFonts runFonts3 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize3 = new FontSize() { Val = "26" };

            paragraphMarkRunProperties2.Append(runFonts3);
            paragraphMarkRunProperties2.Append(fontSize3);

            paragraphProperties2.Append(spacingBetweenLines2);
            paragraphProperties2.Append(paragraphMarkRunProperties2);

            Run run2 = new Run() { RsidRunProperties = "00570900" };
            Bold bold8 = new Bold();

            RunProperties runProperties2 = new RunProperties();
            RunFonts runFonts4 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize4 = new FontSize() { Val = customerDetailsFontSize };

            runProperties2.Append(runFonts4);
            runProperties2.Append(fontSize4);
            runProperties2.Append(bold8);
            Text text2 = new Text() { Space = SpaceProcessingModeValues.Preserve };

            //TODO add in customer first Name
            text2.Text = customer.firstName + " ";

            run2.Append(runProperties2);
            run2.Append(text2);
            ProofError proofError1 = new ProofError() { Type = ProofingErrorValues.SpellStart };

            Run run3 = new Run() { RsidRunProperties = "00570900" };
            Bold bold9 = new Bold();

            RunProperties runProperties3 = new RunProperties();
            RunFonts runFonts5 = new RunFonts() { Ascii = "Arial", HighAnsi = "Arial", ComplexScript = "Arial" };
            FontSize fontSize5 = new FontSize() { Val = customerDetailsFontSize };

            runProperties3.Append(bold9);
            runProperties3.Append(runFonts5);
            runProperties3.Append(fontSize5);
            Text text3 = new Text();

            //TODO add in customer last name
            text3.Text = customer.lastName;

            run3.Append(runProperties3);
            run3.Append(text3);
            ProofError proofError2 = new ProofError() { Type = ProofingErrorValues.SpellEnd };

            paragraph2.Append(paragraphProperties2);
            paragraph2.Append(run2);
            paragraph2.Append(proofError1);
            paragraph2.Append(run3);
            paragraph2.Append(proofError2);

            Paragraph paragraphInstitute = new Paragraph() { RsidParagraphMarkRevision = "00570900", RsidParagraphAddition = "003627FC", RsidParagraphProperties = "003627FC", RsidRunAdditionDefault = "003627FC" };

            ParagraphProperties paragraphInstituteProperties = new ParagraphProperties();
//.........这里部分代码省略.........
开发者ID:CGHill,项目名称:Hard-To-Find,代码行数:101,代码来源:MailingLabelCreator.cs

示例15: GenerateMainDocumentPart1Content

        // Generates content of mainDocumentPart1.
        private void GenerateMainDocumentPart1Content(MainDocumentPart mainDocumentPart1, List<customSection> list)
        {
            Document document1 = new Document() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 wp14" } };
            document1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            document1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            document1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            document1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            document1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            document1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            document1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            document1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            document1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            document1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            document1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            document1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            document1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            document1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            document1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Body body1 = new Body();

            Paragraph paragraph25 = new Paragraph() { RsidParagraphAddition = "003C5001", RsidRunAdditionDefault = "003C5001" };
            BookmarkStart bookmarkStart1 = new BookmarkStart() { Name = "_GoBack", Id = "0" };
            BookmarkEnd bookmarkEnd1 = new BookmarkEnd() { Id = "0" };

            paragraph25.Append(bookmarkStart1);
            paragraph25.Append(bookmarkEnd1);

            SectionProperties sectionProperties1 = new SectionProperties() { RsidR = "003C5001" };
            PageSize pageSize1 = new PageSize() { Width = (UInt32Value)12240U, Height = (UInt32Value)15840U };
            PageMargin pageMargin1 = new PageMargin() { Top = 720, Right = (UInt32Value)720U, Bottom = 720, Left = (UInt32Value)720U, Header = (UInt32Value)720U, Footer = (UInt32Value)720U, Gutter = (UInt32Value)0U };
            Columns columns1 = new Columns() { Space = "720" };
            DocGrid docGrid1 = new DocGrid() { LinePitch = 360 };

            sectionProperties1.Append(pageSize1);
            sectionProperties1.Append(pageMargin1);
            sectionProperties1.Append(columns1);
            sectionProperties1.Append(docGrid1);

            // -------------------------------------------------Insert table here------------------------------------------------------------

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Tab != null)
                {
                    //Table table1 = generateRecommendationTable(list[i].Dt);
                    body1.Append(list[i].Tab);
                }
                else if (list[i].Xml != null)
                {
                    for (int j = 0; j < list[i].Xml.Count; j++)
                    {
                        body1.Append(list[i].Xml[j]);
                    }
                }
                else if (list[i].Image != null)
                {
                    body1.Append(addImage(list[i].Image.Filename, list[i].Image.Link));
                }
                else if (list[i].B != null)
                {
                    body1.Append(list[i].B);
                }
            }

            //body1.Append(paragraph25);
            //body1.Append(sectionProperties1);

            //NotesFor.HtmlToOpenXml.HtmlConverter htmlconv = new NotesFor.HtmlToOpenXml.HtmlConverter(mainDocumentPart1);
            //var paragraphs = htmlconv.Parse(val);
            //for (int i = 0; i < paragraphs.Count; i++)
            //{
            //    body1.Append(paragraphs[i]);
            //}

            document1.Append(body1);

            mainDocumentPart1.Document = document1;
        }
开发者ID:joyoon,项目名称:mb,代码行数:81,代码来源:Generator.cs


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