CreateEdit() static private méthode

static private CreateEdit ( EditType t, System.DateTime edit_time, object content ) : System.Xml.Linq.XElement
t EditType
edit_time System.DateTime
content object
Résultat System.Xml.Linq.XElement
Exemple #1
0
        public virtual void InsertSectionPageBreak(bool trackChanges = false)
        {
            XElement content = new XElement(XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName), new XElement(XName.Get("sectPr", DocX.w.NamespaceName))));

            if (trackChanges)
            {
                content = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, content);
            }
            base.Xml.Add(content);
        }
Exemple #2
0
        public virtual void InsertSection(bool trackChanges)
        {
            XElement content = new XElement(XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName), new XElement(XName.Get("sectPr", DocX.w.NamespaceName), new XElement(XName.Get("type", DocX.w.NamespaceName), new XAttribute(DocX.w + "val", "continuous")))));

            if (trackChanges)
            {
                content = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, content);
            }
            base.Xml.Add(content);
        }
Exemple #3
0
        public virtual void InsertSectionPageBreak(bool trackChanges = false)
        {
            var newParagraphSection = new XElement
                                      (
                XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName), new XElement(XName.Get("sectPr", DocX.w.NamespaceName)))
                                      );

            if (trackChanges)
            {
                newParagraphSection = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, newParagraphSection);
            }

            Xml.Add(newParagraphSection);
        }
Exemple #4
0
        public virtual void InsertSection(bool trackChanges)
        {
            var newParagraphSection = new XElement
                                      (
                XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName), new XElement(XName.Get("sectPr", DocX.w.NamespaceName), new XElement(XName.Get("type", DocX.w.NamespaceName), new XAttribute(DocX.w + "val", "continuous"))))
                                      );

            if (trackChanges)
            {
                newParagraphSection = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, newParagraphSection);
            }

            Xml.Add(newParagraphSection);
        }
Exemple #5
0
        public virtual Paragraph InsertParagraph(string text, bool trackChanges, Formatting formatting)
        {
            XElement newParagraph = new XElement
                                    (
                XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName)), HelperFunctions.FormatInput(text, formatting.Xml)
                                    );

            if (trackChanges)
            {
                newParagraph = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, newParagraph);
            }

            Xml.Add(newParagraph);

            return(Paragraphs.Last());
        }
Exemple #6
0
        public virtual Paragraph InsertParagraph(string text, bool trackChanges, Formatting formatting)
        {
            XElement newParagraph = new XElement
                                    (
                XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName)), HelperFunctions.FormatInput(text, formatting.Xml)
                                    );

            if (trackChanges)
            {
                newParagraph = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, newParagraph);
            }
            Xml.Add(newParagraph);
            var paragraphAdded = new Paragraph(Document, newParagraph, 0);

            if (this is Cell)
            {
                var cell = this as Cell;
                paragraphAdded.PackagePart = cell.mainPart;
            }
            else if (this is DocX)
            {
                paragraphAdded.PackagePart = Document.mainPart;
            }
            else if (this is Footer)
            {
                var f = this as Footer;
                paragraphAdded.mainPart = f.mainPart;
            }
            else if (this is Header)
            {
                var h = this as Header;
                paragraphAdded.mainPart = h.mainPart;
            }
            else
            {
                Console.WriteLine("No idea what we are {0}", this);
                paragraphAdded.PackagePart = Document.mainPart;
            }


            GetParent(paragraphAdded);

            return(paragraphAdded);
        }
Exemple #7
0
        public virtual Paragraph InsertParagraph(string text, bool trackChanges, Formatting formatting)
        {
            XElement xElement = new XElement(XName.Get("p", DocX.w.NamespaceName), new XElement(XName.Get("pPr", DocX.w.NamespaceName)), HelperFunctions.FormatInput(text, formatting.Xml));

            if (trackChanges)
            {
                xElement = HelperFunctions.CreateEdit(EditType.ins, DateTime.Now, xElement);
            }
            base.Xml.Add(xElement);
            Paragraph paragraph = new Paragraph(base.Document, xElement, 0);

            if (this is Cell)
            {
                Cell cell = this as Cell;
                paragraph.PackagePart = cell.mainPart;
            }
            else if (this is DocX)
            {
                paragraph.PackagePart = base.Document.mainPart;
            }
            else if (this is Footer)
            {
                Footer footer = this as Footer;
                paragraph.mainPart = footer.mainPart;
            }
            else if (this is Header)
            {
                Header header = this as Header;
                paragraph.mainPart = header.mainPart;
            }
            else
            {
                Console.WriteLine("No idea what we are {0}", this);
                paragraph.PackagePart = base.Document.mainPart;
            }
            GetParent(paragraph);
            return(paragraph);
        }