private void removeCitations()
        {
            List <Hyperlink> links = new List <Hyperlink>();

            Hyperlinks contentLinks = Globals.ThisAddIn.Application.ActiveDocument.Content.Hyperlinks;

            for (int i = 0; i < contentLinks.Count; i++)
            {
                links.Add(contentLinks[i + 1]);
            }

            Footnotes footnotes = Globals.ThisAddIn.Application.ActiveDocument.Footnotes;

            foreach (Word.Footnote footnote in footnotes)
            {
                for (int i = 0; i < footnote.Range.Hyperlinks.Count; i++)
                {
                    links.Add(footnote.Range.Hyperlinks[i + 1]);
                }
            }

            links.Where(l => l.SubAddress == LinkRef).ToList().ForEach(l =>
            {
                l.Delete();
            });
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public async Task <MemoryStream> Save()
        {
            MemoryStream stream = DocxFilePath.Create();

            stream = await Document.WriteInto(stream, "word/document.xml");

            stream = await Footnotes.WriteInto(stream, "word/footnotes.xml");

            stream = await ContentTypes.WriteInto(stream, ContentTypesInfo.Path);

            stream = await DocumentRelations.WriteInto(stream, DocumentRelsInfo.Path);

            stream = await FootnoteRelations.WriteInto(stream, "word/_rels/footnotes.xml.rels");

            stream = await Styles.WriteInto(stream, "word/styles.xml");

            stream = await Numbering.WriteInto(stream, "word/numbering.xml");

            stream = await Theme1.WriteInto(stream, "word/theme/theme1.xml");

            foreach (ChartInformation item in Charts)
            {
                stream = await item.Chart.WriteInto(stream, $"word/{item.Name}");
            }

            return(stream);
        }
Ejemplo n.º 3
0
 private TrainTime CopyWithTime(TimeOfDay newTime)
 {
     return(new TrainTime
     {
         Time = newTime,
         Footnotes = Footnotes.ToList(),
     });
 }
Ejemplo n.º 4
0
 public DataReplacementPlanViewModel ToSummary()
 {
     return(new DataReplacementPlanViewModel(
                DataBlocks.Select(block => block.ToSummary()),
                Footnotes.Select(footnote => footnote.ToSummary()),
                OriginalSubjectId,
                ReplacementSubjectId
                ));
 }
Ejemplo n.º 5
0
        public void loadFootnotes()
        {
            List <HtmlNode> found = Document.query("//table[@class='sc_footnotes']//tr");

            foreach (HtmlNode n in found)
            {
                string note = n.LastChild.InnerText;
                Footnotes.Add(note);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Attempt to populate the <see cref="Footnotes"/> property,
        /// </summary>
        /// <param name="allFootnotes"></param>
        public void ResolveFootnotes(IDictionary <string, Note> allFootnotes)
        {
            if (allFootnotes is null)
            {
                throw new ArgumentNullException(nameof(allFootnotes));
            }
            List <string> currentIds = Footnotes.Select(n => n.Id).ToList();

            for (int i = 0; i < currentIds.Count; ++i)
            {
                if (allFootnotes.ContainsKey(currentIds[i]))
                {
                    Footnotes[i] = allFootnotes[currentIds[i]];
                }
            }
        }
        /// <summary>
        /// Initializes an <see cref="OpenXmlPackageVisitor"/> by reading document parts into memory.
        /// </summary>
        /// <param name="package">The package to which changes can be saved.</param>
        /// <exception cref="ArgumentNullException"/>
        public OpenXmlPackageVisitor([NotNull] Package package)
        {
            if (package is null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            if (!package.FileOpenAccess.HasFlag(FileAccess.Read))
            {
                throw new IOException("The package is write-only.");
            }

            Package =
                package.FileOpenAccess.HasFlag(FileAccess.Write)
                    ? package.ToPackage()
                    : package;

            Document  = new Document(package);
            Footnotes = new Footnotes(package);

            Uri stylesUri = new Uri("/word/styles.xml", UriKind.Relative);

            Styles =
                package.PartExists(stylesUri)
                    ? XElement.Load(package.GetPart(stylesUri).GetStream())
                    : new XElement(W + "styles",
                                   new XAttribute(XNamespace.Xmlns + "w", W));

            Uri numberingUri = new Uri("/word/numbering.xml", UriKind.Relative);

            Numbering =
                package.PartExists(numberingUri)
                    ? XElement.Load(package.GetPart(numberingUri).GetStream())
                    : new XElement(W + "numbering",
                                   new XAttribute(XNamespace.Xmlns + "w", W));

            Uri themeUri = new Uri("/word/theme/theme1.xml", UriKind.Relative);

            Theme1 =
                package.PartExists(themeUri)
                    ? XElement.Load(package.GetPart(themeUri).GetStream())
                    : new XElement(A + "theme",
                                   new XAttribute(XNamespace.Xmlns + "a", A));
        }
Ejemplo n.º 8
0
        /// <inheritdoc />
        public void Save(DocxFilePath result)
        {
            if (result is null)
            {
                throw new ArgumentNullException(nameof(result));
            }

            Document.WriteInto(result, "word/document.xml");
            Footnotes.WriteInto(result, "word/footnotes.xml");
            ContentTypes.WriteInto(result, ContentTypesInfo.Path);
            DocumentRelations.WriteInto(result, DocumentRelsInfo.Path);
            FootnoteRelations.WriteInto(result, "word/_rels/footnotes.xml.rels");
            Styles.WriteInto(result, "word/styles.xml");
            Numbering.WriteInto(result, "word/numbering.xml");
            Theme1.WriteInto(result, "word/theme/theme1.xml");

            foreach (ChartInformation item in Charts)
            {
                item.Chart.WriteInto(result, $"word/{item.Name}");
            }
        }
        private OpenXmlPackageVisitor Fold([NotNull] OpenXmlPackageVisitor subject)
        {
            Document document = Document.Concat(subject.Document);

            Footnotes footnotes = Footnotes.Concat(subject.Footnotes);

            XElement styles =
                new XElement(
                    Styles.Name,
                    Styles.Attributes(),
                    Styles.Elements()
                    .Union(
                        subject.Styles
                        .Elements()
                        .Where(x => x.Name != W + "docDefaults")
                        .Where(x => (string)x.Attribute(W + "styleId") != "Normal"),
                        XNode.EqualityComparer));

            XElement numbering =
                new XElement(
                    Numbering.Name,
                    Numbering.Attributes(),
                    Numbering.Elements()
                    .Union(
                        subject.Numbering.Elements(),
                        XNode.EqualityComparer));

            // TODO: write a ThemeVisit
//            XElement theme =
//                new XElement(
//                    Theme.TargetUri,
//                    Theme.Attributes(),
//                    Theme.Elements()
//                          .Union(
//                              subject.Theme.Elements(),
//                              XNode.EqualityComparer));

            return(With(document, footnotes, styles, numbering, subject.Theme1));
        }
Ejemplo n.º 10
0
        public void CompareTest()
        {
            Application word      = new Application();
            Document    document1 = word.Documents.Open(@"G:\abi\word_module\Word_Table\doc1.docx");
            Document    document2 = word.Documents.Open(@"G:\abi\word_module\Word_Table\doc2.docx");

            word.Visible = true;

            Range range1 = document1.Range();
            Range range2 = document2.Range();

            Footnotes footnotes1 = range1.Footnotes;
            Footnotes footnotes2 = range2.Footnotes;


            ABIW_FootNotes aBIW_FootNotes1 = new ABIW_FootNotes(footnotes1);
            ABIW_FootNotes aBIW_FootNotes2 = new ABIW_FootNotes(footnotes2);

            string result = aBIW_FootNotes1.Compare(aBIW_FootNotes2).Result.ToString();

            document1.Close();
            document2.Close();
            word.Quit();
        }
Ejemplo n.º 11
0
        // Generates content of footnotesPart1.
        private void GenerateFootnotesPart1Content(FootnotesPart footnotesPart1)
        {
            Footnotes footnotes1 = new Footnotes() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 wp14" } };
            footnotes1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            footnotes1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            footnotes1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            footnotes1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            footnotes1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            footnotes1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            footnotes1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            footnotes1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            footnotes1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            footnotes1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            footnotes1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            footnotes1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            footnotes1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Footnote footnote1 = new Footnote() { Type = FootnoteEndnoteValues.Separator, Id = -1 };

            Paragraph paragraph57 = new Paragraph() { RsidParagraphAddition = "00571FC0", RsidRunAdditionDefault = "00571FC0" };

            ParagraphProperties paragraphProperties55 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines45 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };

            paragraphProperties55.Append(spacingBetweenLines45);

            Run run61 = new Run();
            SeparatorMark separatorMark2 = new SeparatorMark();

            run61.Append(separatorMark2);

            paragraph57.Append(paragraphProperties55);
            paragraph57.Append(run61);

            footnote1.Append(paragraph57);

            Footnote footnote2 = new Footnote() { Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 };

            Paragraph paragraph58 = new Paragraph() { RsidParagraphAddition = "00571FC0", RsidRunAdditionDefault = "00571FC0" };

            ParagraphProperties paragraphProperties56 = new ParagraphProperties();
            SpacingBetweenLines spacingBetweenLines46 = new SpacingBetweenLines() { After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto };

            paragraphProperties56.Append(spacingBetweenLines46);

            Run run62 = new Run();
            ContinuationSeparatorMark continuationSeparatorMark2 = new ContinuationSeparatorMark();

            run62.Append(continuationSeparatorMark2);

            paragraph58.Append(paragraphProperties56);
            paragraph58.Append(run62);

            footnote2.Append(paragraph58);

            footnotes1.Append(footnote1);
            footnotes1.Append(footnote2);

            footnotesPart1.Footnotes = footnotes1;
        }
Ejemplo n.º 12
0
        // Generates content of footnotesPart1.
        private void GenerateFootnotesPart1Content(FootnotesPart footnotesPart1)
        {
            Footnotes footnotes1 = new Footnotes(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15 wp14" }  };
            footnotes1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            footnotes1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            footnotes1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            footnotes1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            footnotes1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            footnotes1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            footnotes1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            footnotes1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            footnotes1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            footnotes1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2010/11/wordml");
            footnotes1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            footnotes1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            footnotes1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            footnotes1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Footnote footnote1 = new Footnote(){ Type = FootnoteEndnoteValues.Separator, Id = -1 };

            Paragraph paragraph6 = new Paragraph(){ RsidParagraphAddition = "006529C4", RsidParagraphProperties = "00157205", RsidRunAdditionDefault = "006529C4" };

            Run run9 = new Run();
            SeparatorMark separatorMark2 = new SeparatorMark();

            run9.Append(separatorMark2);

            paragraph6.Append(run9);

            footnote1.Append(paragraph6);

            Footnote footnote2 = new Footnote(){ Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 };

            Paragraph paragraph7 = new Paragraph(){ RsidParagraphAddition = "006529C4", RsidParagraphProperties = "00157205", RsidRunAdditionDefault = "006529C4" };

            Run run10 = new Run();
            ContinuationSeparatorMark continuationSeparatorMark2 = new ContinuationSeparatorMark();

            run10.Append(continuationSeparatorMark2);

            paragraph7.Append(run10);

            footnote2.Append(paragraph7);

            Footnote footnote3 = new Footnote(){ Id = 1 };

            Paragraph paragraph8 = new Paragraph(){ RsidParagraphAddition = "003E4104", RsidRunAdditionDefault = "003E4104" };

            ParagraphProperties paragraphProperties1 = new ParagraphProperties();
            ParagraphStyleId paragraphStyleId1 = new ParagraphStyleId(){ Val = "a3" };

            paragraphProperties1.Append(paragraphStyleId1);

            Run run11 = new Run();

            RunProperties runProperties7 = new RunProperties();
            RunStyle runStyle4 = new RunStyle(){ Val = "a5" };

            runProperties7.Append(runStyle4);
            FootnoteReferenceMark footnoteReferenceMark1 = new FootnoteReferenceMark();

            run11.Append(runProperties7);
            run11.Append(footnoteReferenceMark1);

            Run run12 = new Run();
            Text text4 = new Text(){ Space = SpaceProcessingModeValues.Preserve };
            text4.Text = " ";

            run12.Append(text4);

            Run run13 = new Run();

            RunProperties runProperties8 = new RunProperties();
            RunFonts runFonts5 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };

            runProperties8.Append(runFonts5);
            Text text5 = new Text();
            text5.Text = "Reference 1";

            run13.Append(runProperties8);
            run13.Append(text5);

            paragraph8.Append(paragraphProperties1);
            paragraph8.Append(run11);
            paragraph8.Append(run12);
            paragraph8.Append(run13);

            footnote3.Append(paragraph8);

            Footnote footnote4 = new Footnote(){ Id = 2 };

            Paragraph paragraph9 = new Paragraph(){ RsidParagraphAddition = "003E4104", RsidRunAdditionDefault = "003E4104" };

            ParagraphProperties paragraphProperties2 = new ParagraphProperties();
            ParagraphStyleId paragraphStyleId2 = new ParagraphStyleId(){ Val = "a3" };

            paragraphProperties2.Append(paragraphStyleId2);

            Run run14 = new Run();

            RunProperties runProperties9 = new RunProperties();
            RunStyle runStyle5 = new RunStyle(){ Val = "a5" };

            runProperties9.Append(runStyle5);
            FootnoteReferenceMark footnoteReferenceMark2 = new FootnoteReferenceMark();

            run14.Append(runProperties9);
            run14.Append(footnoteReferenceMark2);

            Run run15 = new Run();
            Text text6 = new Text(){ Space = SpaceProcessingModeValues.Preserve };
            text6.Text = " ";

            run15.Append(text6);

            Run run16 = new Run();

            RunProperties runProperties10 = new RunProperties();
            RunFonts runFonts6 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };

            runProperties10.Append(runFonts6);
            Text text7 = new Text();
            text7.Text = "Reference 2";

            run16.Append(runProperties10);
            run16.Append(text7);

            paragraph9.Append(paragraphProperties2);
            paragraph9.Append(run14);
            paragraph9.Append(run15);
            paragraph9.Append(run16);

            footnote4.Append(paragraph9);

            Footnote footnote5 = new Footnote(){ Id = 3 };

            Paragraph paragraph10 = new Paragraph(){ RsidParagraphAddition = "003E4104", RsidRunAdditionDefault = "003E4104" };

            ParagraphProperties paragraphProperties3 = new ParagraphProperties();
            ParagraphStyleId paragraphStyleId3 = new ParagraphStyleId(){ Val = "a3" };

            paragraphProperties3.Append(paragraphStyleId3);

            Run run17 = new Run();

            RunProperties runProperties11 = new RunProperties();
            RunStyle runStyle6 = new RunStyle(){ Val = "a5" };

            runProperties11.Append(runStyle6);
            FootnoteReferenceMark footnoteReferenceMark3 = new FootnoteReferenceMark();

            run17.Append(runProperties11);
            run17.Append(footnoteReferenceMark3);

            Run run18 = new Run();
            Text text8 = new Text(){ Space = SpaceProcessingModeValues.Preserve };
            text8.Text = " ";

            run18.Append(text8);

            Run run19 = new Run();

            RunProperties runProperties12 = new RunProperties();
            RunFonts runFonts7 = new RunFonts(){ Hint = FontTypeHintValues.EastAsia };

            runProperties12.Append(runFonts7);
            Text text9 = new Text();
            text9.Text = "Reference 3";

            run19.Append(runProperties12);
            run19.Append(text9);

            paragraph10.Append(paragraphProperties3);
            paragraph10.Append(run17);
            paragraph10.Append(run18);
            paragraph10.Append(run19);

            footnote5.Append(paragraph10);

            footnotes1.Append(footnote1);
            footnotes1.Append(footnote2);
            footnotes1.Append(footnote3);
            footnotes1.Append(footnote4);
            footnotes1.Append(footnote5);

            footnotesPart1.Footnotes = footnotes1;
        }
Ejemplo n.º 13
0
        public static void GenerateFootnotesPart1Content(FootnotesPart footnotesPart1)
        {
            var footnotes1 = new Footnotes {
                MCAttributes = new MarkupCompatibilityAttributes()
                {
                    Ignorable = "w14 w15 w16se w16cid wp14"
                }
            };

            footnotes1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            footnotes1.AddNamespaceDeclaration("cx", "http://schemas.microsoft.com/office/drawing/2014/chartex");
            footnotes1.AddNamespaceDeclaration("cx1", "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
            footnotes1.AddNamespaceDeclaration("cx2", "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex");
            footnotes1.AddNamespaceDeclaration("cx3", "http://schemas.microsoft.com/office/drawing/2016/5/9/chartex");
            footnotes1.AddNamespaceDeclaration("cx4", "http://schemas.microsoft.com/office/drawing/2016/5/10/chartex");
            footnotes1.AddNamespaceDeclaration("cx5", "http://schemas.microsoft.com/office/drawing/2016/5/11/chartex");
            footnotes1.AddNamespaceDeclaration("cx6", "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex");
            footnotes1.AddNamespaceDeclaration("cx7", "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex");
            footnotes1.AddNamespaceDeclaration("cx8", "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex");
            footnotes1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            footnotes1.AddNamespaceDeclaration("aink", "http://schemas.microsoft.com/office/drawing/2016/ink");
            footnotes1.AddNamespaceDeclaration("am3d", "http://schemas.microsoft.com/office/drawing/2017/model3d");
            footnotes1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            footnotes1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            footnotes1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            footnotes1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            footnotes1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            footnotes1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            footnotes1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            footnotes1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            footnotes1.AddNamespaceDeclaration("w16cid", "http://schemas.microsoft.com/office/word/2016/wordml/cid");
            footnotes1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");
            footnotes1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            footnotes1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            footnotes1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            footnotes1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            var footnote1 = new Footnote {
                Type = FootnoteEndnoteValues.Separator, Id = -1
            };

            var paragraph274 = new Paragraph {
                RsidParagraphAddition = "003C529E", RsidRunAdditionDefault = "003C529E", ParagraphId = "46435F23", TextId = "77777777"
            };

            var paragraphProperties177 = new ParagraphProperties();
            var spacingBetweenLines173 = new SpacingBetweenLines {
                After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto
            };

            paragraphProperties177.Append(spacingBetweenLines173);

            var run403         = new Run();
            var separatorMark2 = new SeparatorMark();

            run403.Append(separatorMark2);

            paragraph274.Append(paragraphProperties177);
            paragraph274.Append(run403);

            footnote1.Append(paragraph274);

            var footnote2 = new Footnote {
                Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0
            };

            var paragraph275 = new Paragraph {
                RsidParagraphAddition = "003C529E", RsidRunAdditionDefault = "003C529E", ParagraphId = "69C342F4", TextId = "77777777"
            };

            var paragraphProperties178 = new ParagraphProperties();
            var spacingBetweenLines174 = new SpacingBetweenLines {
                After = "0", Line = "240", LineRule = LineSpacingRuleValues.Auto
            };

            paragraphProperties178.Append(spacingBetweenLines174);

            var run404 = new Run();
            var continuationSeparatorMark2 = new ContinuationSeparatorMark();

            run404.Append(continuationSeparatorMark2);

            paragraph275.Append(paragraphProperties178);
            paragraph275.Append(run404);

            footnote2.Append(paragraph275);

            footnotes1.Append(footnote1);
            footnotes1.Append(footnote2);

            footnotesPart1.Footnotes = footnotes1;
        }
Ejemplo n.º 14
0
        // Generates content of footnotesPart1.
        private void GenerateFootnotesPart1Content(FootnotesPart footnotesPart1)
        {
            Footnotes footnotes1 = new Footnotes() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se wp14" } };
            footnotes1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            footnotes1.AddNamespaceDeclaration("cx", "http://schemas.microsoft.com/office/drawing/2014/chartex");
            footnotes1.AddNamespaceDeclaration("cx1", "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
            footnotes1.AddNamespaceDeclaration("cx2", "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex");
            footnotes1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            footnotes1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            footnotes1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            footnotes1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            footnotes1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            footnotes1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            footnotes1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            footnotes1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            footnotes1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
            footnotes1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");
            footnotes1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            footnotes1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            footnotes1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            footnotes1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Footnote footnote1 = new Footnote() { Type = FootnoteEndnoteValues.Separator, Id = -1 };

            Paragraph paragraph375 = new Paragraph() { RsidParagraphAddition = "00A563A2", RsidRunAdditionDefault = "00A563A2", ParagraphId = "07FB7F42", TextId = "77777777" };

            Run run763 = new Run();
            SeparatorMark separatorMark2 = new SeparatorMark();

            run763.Append(separatorMark2);

            paragraph375.Append(run763);

            footnote1.Append(paragraph375);

            Footnote footnote2 = new Footnote() { Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 };

            Paragraph paragraph376 = new Paragraph() { RsidParagraphAddition = "00A563A2", RsidRunAdditionDefault = "00A563A2", ParagraphId = "7D479935", TextId = "77777777" };

            Run run764 = new Run();
            ContinuationSeparatorMark continuationSeparatorMark2 = new ContinuationSeparatorMark();

            run764.Append(continuationSeparatorMark2);

            paragraph376.Append(run764);

            footnote2.Append(paragraph376);

            Footnote footnote3 = new Footnote() { Type = FootnoteEndnoteValues.ContinuationNotice, Id = 1 };
            Paragraph paragraph377 = new Paragraph() { RsidParagraphAddition = "00A563A2", RsidRunAdditionDefault = "00A563A2", ParagraphId = "6E418186", TextId = "77777777" };

            footnote3.Append(paragraph377);

            footnotes1.Append(footnote1);
            footnotes1.Append(footnote2);
            footnotes1.Append(footnote3);

            footnotesPart1.Footnotes = footnotes1;
        }
Ejemplo n.º 15
0
 public static Footnotes CreateFootnotes(string uniqueId, short sequenceId, int ID)
 {
     Footnotes footnotes = new Footnotes();
     footnotes.UniqueId = uniqueId;
     footnotes.SequenceId = sequenceId;
     footnotes.Id = ID;
     return footnotes;
 }
Ejemplo n.º 16
0
 public void UpdateFootnotes(Footnotes notes)
 {
     db.Entry(notes).State = EntityState.Modified;
     db.SaveChanges();
 }
        // Generates content of footnotesPart1.
        private void GenerateFootnotesPart1Content(FootnotesPart footnotesPart1)
        {
            Footnotes footnotes1 = new Footnotes();

            Footnote footnote1 = new Footnote() { Type = FootnoteEndnoteValues.Separator, Id = -1 };

            Paragraph paragraph49 = new Paragraph() { RsidParagraphAddition = "004805C1", RsidRunAdditionDefault = "004805C1" };

            Run run52 = new Run();
            SeparatorMark separatorMark2 = new SeparatorMark();

            run52.Append(separatorMark2);

            paragraph49.Append(run52);

            footnote1.Append(paragraph49);

            Footnote footnote2 = new Footnote() { Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 };

            Paragraph paragraph50 = new Paragraph() { RsidParagraphAddition = "004805C1", RsidRunAdditionDefault = "004805C1" };

            Run run53 = new Run();
            ContinuationSeparatorMark continuationSeparatorMark2 = new ContinuationSeparatorMark();

            run53.Append(continuationSeparatorMark2);

            paragraph50.Append(run53);

            footnote2.Append(paragraph50);

            footnotes1.Append(footnote1);
            footnotes1.Append(footnote2);

            footnotesPart1.Footnotes = footnotes1;
        }
        private static int AddOtherParts(Stream stream, int count)
        {
            const int firstId = 0;

            using WordprocessingDocument wordDocument = WordprocessingDocument.Open(stream, true);
            wordDocument.AddParagraphIdFeature();

            MainDocumentPart mainDocumentPart = wordDocument.MainDocumentPart !;

            // Add Header.
            var headerParagraph = new Paragraph(new Run(new Text("Header")));

            var headerPart = mainDocumentPart.AddNewPart <HeaderPart>();

            headerPart.Header = new Header(headerParagraph);

            // Add Footer.
            var footerParagraph = new Paragraph(new Run(new Text("Footer")));

            var footerPart = mainDocumentPart.AddNewPart <FooterPart>();

            footerPart.Footer = new Footer(footerParagraph);

            // Add Comments.
            var comments = new Comments();

            for (var id = firstId; id < firstId + count; id++)
            {
                var paragraph = new Paragraph(new Run(new Text($"Comment #{id}")));

                comments.AppendChild(new Comment(paragraph)
                {
                    Id     = id.ToString(),
                    Author = $"Author #{id}",
                });
            }

            var commentsPart = mainDocumentPart.AddNewPart <WordprocessingCommentsPart>();

            commentsPart.Comments = comments;

            // Add Footnotes
            var footnotes = new Footnotes();

            for (var id = firstId; id < firstId + count; id++)
            {
                var paragraph = new Paragraph(new Run(new Text($"Footnote #{id}")));

                footnotes.AppendChild(new Footnote(paragraph)
                {
                    Id = id
                });
            }

            var footnotesPart = mainDocumentPart.AddNewPart <FootnotesPart>();

            footnotesPart.Footnotes = footnotes;

            // Add Endnotes.
            var endnotes = new Endnotes();

            for (var id = firstId; id < firstId + count; id++)
            {
                var paragraph = new Paragraph(new Run(new Text($"Endnote #{id}")));

                endnotes.AppendChild(new Endnote(paragraph)
                {
                    Id = id
                });
            }

            var endnotesPart = mainDocumentPart.AddNewPart <EndnotesPart>();

            endnotesPart.Endnotes = endnotes;

            return((3 * count) + 2);
        }
        public OpenXmlPackageVisitor With(
            [CanBeNull] Document document   = default,
            [CanBeNull] Footnotes footnotes = default,
            [CanBeNull] XElement styles     = default,
            [CanBeNull] XElement numbering  = default,
            [CanBeNull] XElement theme1     = default)
        {
            Package package = DefaultOpenXmlPackage.ToPackage(FileAccess.ReadWrite);

            (document ?? Document).CopyTo(package);
            (footnotes ?? Footnotes).CopyTo(package);

            PackagePart documentPart = package.GetPart(Document.PartUri);

            SaveHelper(
                package,
                documentPart,
                new Uri("/word/styles.xml", UriKind.Relative),
                "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",
                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",
                styles ?? Styles);

            SaveHelper(
                package,
                documentPart,
                new Uri("/word/numbering.xml", UriKind.Relative),
                "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",
                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",
                numbering ?? Numbering);

            SaveHelper(
                package,
                documentPart,
                new Uri("/word/theme/theme1.xml", UriKind.Relative),
                "application/vnd.openxmlformats-officedocument.theme+xml",
                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",
                theme1 ?? Theme1);

            SaveHelper(
                package,
                documentPart,
                new Uri("/word/settings.xml", UriKind.Relative),
                "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",
                "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",
                new XElement(W + "settings",
                             new XAttribute(XNamespace.Xmlns + "w", W),
                             new XAttribute(XNamespace.Xmlns + "m", M),
                             new XElement(W + "evenAndOddHeaders"),
                             new XElement(M + "mathPr",
                                          new XElement(M + "mathFont",
                                                       new XAttribute(M + "val", "Cambria Math")),
                                          new XElement(M + "intLim",
                                                       new XAttribute(M + "val", "subSup")),
                                          new XElement(M + "naryLim",
                                                       new XAttribute(M + "val", "subSup"))),
                             new XElement(W + "rsids",
                                          new XElement(W + "rsidRoot",
                                                       new XAttribute(W + "val", package.GetHashCode().ToString("X8"))))));

            return(new OpenXmlPackageVisitor(package));
        }
Ejemplo n.º 20
0
 public void AddToFootnotes(Footnotes footnotes)
 {
     base.AddObject("Footnotes", footnotes);
 }
Ejemplo n.º 21
0
        // Generates content of footnotesPart1.
        private void GenerateFootnotesPart1Content(FootnotesPart footnotesPart1)
        {
            Footnotes footnotes1 = new Footnotes(){ MCAttributes = new MarkupCompatibilityAttributes(){ Ignorable = "w14 w15 wp14" }  };
            footnotes1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
            footnotes1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
            footnotes1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
            footnotes1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
            footnotes1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
            footnotes1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
            footnotes1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
            footnotes1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
            footnotes1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
            footnotes1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
            footnotes1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2010/11/wordml");
            footnotes1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
            footnotes1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
            footnotes1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
            footnotes1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");

            Footnote footnote1 = new Footnote(){ Type = FootnoteEndnoteValues.Separator, Id = -1 };

            Paragraph paragraph25 = new Paragraph(){ RsidParagraphAddition = "00DC649D", RsidParagraphProperties = "00E930A2", RsidRunAdditionDefault = "00DC649D" };

            Run run31 = new Run();
            SeparatorMark separatorMark2 = new SeparatorMark();

            run31.Append(separatorMark2);

            paragraph25.Append(run31);

            footnote1.Append(paragraph25);

            Footnote footnote2 = new Footnote(){ Type = FootnoteEndnoteValues.ContinuationSeparator, Id = 0 };

            Paragraph paragraph26 = new Paragraph(){ RsidParagraphAddition = "00DC649D", RsidParagraphProperties = "00E930A2", RsidRunAdditionDefault = "00DC649D" };

            Run run32 = new Run();
            ContinuationSeparatorMark continuationSeparatorMark2 = new ContinuationSeparatorMark();

            run32.Append(continuationSeparatorMark2);

            paragraph26.Append(run32);

            footnote2.Append(paragraph26);

            footnotes1.Append(footnote1);
            footnotes1.Append(footnote2);

            footnotesPart1.Footnotes = footnotes1;
        }
Ejemplo n.º 22
0
 public ABIW_FootNotes(Footnotes footnotes)
 {
     this.footnotes       = footnotes;
     this.rangeParent     = footnotes.Parent;
     this.footnoteOptions = rangeParent.FootnoteOptions;
 }