Exemple #1
0
        public XWPFF(CT_F f, IRunBody p)
        {
            this.f      = f;
            this.parent = p;

            if (f.fPr == null)
            {
                f.fPr = new CT_FPr();
            }

            if (f.fPr.type == null)
            {
                f.fPr.type = new CT_FType();
            }

            if (f.num == null)
            {
                f.num = new CT_OMathArg();
            }
            this.num = new XWPFOMathArg(f.num, this);

            if (f.den == null)
            {
                f.den = new CT_OMathArg();
            }
            this.den = new XWPFOMathArg(f.den, this);
        }
Exemple #2
0
 public XWPFSDTContent(CT_SdtContentBlock block, IBody part, IRunBody parent)
 {
     
     foreach (object o in block.Items)
     {
         if (o is CT_P)
         {
             XWPFParagraph p = new XWPFParagraph((CT_P)o, part);
             bodyElements.Add(p);
             paragraphs.Add(p);
         }
         else if (o is CT_Tbl)
         {
             XWPFTable t = new XWPFTable((CT_Tbl)o, part);
             bodyElements.Add(t);
             tables.Add(t);
         }
         else if (o is CT_SdtBlock)
         {
             XWPFSDT c = new XWPFSDT(((CT_SdtBlock)o), part);
             bodyElements.Add(c);
             contentControls.Add(c);
         }
         else if (o is CT_R)
         {
             XWPFRun run = new XWPFRun((CT_R)o, parent);
             runs.Add(run);
             bodyElements.Add(run);
         }
     }
 }
Exemple #3
0
 public XWPFSDTContent(CT_SdtContentBlock block, IBody part, IRunBody parent)
 {
     foreach (object o in block.Items)
     {
         if (o is CT_P)
         {
             XWPFParagraph p = new XWPFParagraph((CT_P)o, part);
             bodyElements.Add(p);
             paragraphs.Add(p);
         }
         else if (o is CT_Tbl)
         {
             XWPFTable t = new XWPFTable((CT_Tbl)o, part);
             bodyElements.Add(t);
             tables.Add(t);
         }
         else if (o is CT_SdtBlock)
         {
             XWPFSDT c = new XWPFSDT(((CT_SdtBlock)o), part);
             bodyElements.Add(c);
             contentControls.Add(c);
         }
         else if (o is CT_R)
         {
             XWPFRun run = new XWPFRun((CT_R)o, parent);
             runs.Add(run);
             bodyElements.Add(run);
         }
     }
 }
Exemple #4
0
        public XWPFNary(CT_Nary nary, IRunBody p)
        {
            this.nary   = nary;
            this.parent = p;

            if (nary.e == null)
            {
                nary.e = new CT_OMathArg();
            }
            this.e = new XWPFOMathArg(nary.e, this);

            if (nary.sub == null)
            {
                nary.sub = new CT_OMathArg();
            }
            this.sub = new XWPFOMathArg(nary.sub, this);

            if (nary.sup == null)
            {
                nary.sup = new CT_OMathArg();
            }
            this.sup = new XWPFOMathArg(nary.sup, this);

            if (nary.naryPr == null)
            {
                nary.naryPr = new CT_NaryPr();
            }

            if (nary.naryPr.chr == null)
            {
                nary.naryPr.chr = new CT_Char();
            }
        }
Exemple #5
0
        public MathContainer(IOMathContainer c, IRunBody p)
        {
            container = c;
            parent    = p;
            document  = p.Document;

            FillLists(c.Items);
        }
Exemple #6
0
 public XWPFSDTContent(CT_SdtContentRun sdtRun, IBody part, IRunBody parent)
 {
     foreach (CT_R ctr in sdtRun.GetRList())
     {
         XWPFRun run = new XWPFRun((CT_R)ctr, parent);
         runs.Add(run);
         bodyElements.Add(run);
     }
 }
Exemple #7
0
 public XWPFSDTContent(CT_SdtContentRun sdtRun, IBody part, IRunBody parent)
 {
     foreach (CT_R ctr in sdtRun.GetRList())
     {
         XWPFRun run = new XWPFRun((CT_R)ctr, parent);
         runs.Add(run);
         bodyElements.Add(run);
     }
 }
Exemple #8
0
        public XWPFSSup(CT_SSup ssup, IRunBody p)
        {
            this.ssup   = ssup;
            this.parent = p;

            if (ssup.e == null)
            {
                ssup.e = new CT_OMathArg();
            }
            this.e = new XWPFOMathArg(ssup.e, this);

            if (ssup.sup == null)
            {
                ssup.sup = new CT_OMathArg();
            }
            this.sup = new XWPFOMathArg(ssup.sup, this);
        }
Exemple #9
0
        public XWPFSSub(CT_SSub ssub, IRunBody p)
        {
            this.ssub   = ssub;
            this.parent = p;

            if (ssub.e == null)
            {
                ssub.e = new CT_OMathArg();
            }
            this.e = new XWPFOMathArg(ssub.e, this);

            if (ssub.sub == null)
            {
                ssub.sub = new CT_OMathArg();
            }
            this.sub = new XWPFOMathArg(ssub.sub, this);
        }
Exemple #10
0
 public XWPFAcc(CT_Acc acc, IRunBody p)
 {
     this.acc    = acc;
     this.parent = p;
     if (acc.e == null)
     {
         acc.e = new CT_OMathArg();
     }
     this.e = new XWPFOMathArg(acc.e, this);
     if (acc.accPr == null)
     {
         acc.accPr = new CT_AccPr();
     }
     if (acc.accPr.chr == null)
     {
         acc.accPr.chr = new CT_Char();
     }
 }
Exemple #11
0
        public XWPFRad(CT_Rad rad, IRunBody p)
        {
            this.rad    = rad;
            this.parent = p;

            //TODO: Implement public radPr
            if (rad.radPr == null)
            {
                rad.radPr = new CT_RadPr();
            }

            if (rad.deg == null)
            {
                rad.deg = new CT_OMathArg();
            }
            this.deg = new XWPFOMathArg(rad.deg, this);

            if (rad.e == null)
            {
                rad.e = new CT_OMathArg();
            }

            this.e = new XWPFOMathArg(rad.e, this);
        }
Exemple #12
0
 public XWPFOMathArg(IOMathContainer c, IRunBody p) : base(c, p)
 {
 }
Exemple #13
0
        /**
         * @param r the CT_R bean which holds the run.attributes
         * @param p the parent paragraph
         */
        public XWPFRun(CT_R r, IRunBody p)
        {
            this.run    = r;
            this.parent = p;

            /**
             * reserve already occupied Drawing ids, so reserving new ids later will
             * not corrupt the document
             */
            IList <CT_Drawing> drawingList = r.GetDrawingList();

            foreach (CT_Drawing ctDrawing in drawingList)
            {
                List <CT_Anchor> anchorList = ctDrawing.GetAnchorList();
                foreach (CT_Anchor anchor in anchorList)
                {
                    if (anchor.docPr != null)
                    {
                        this.Document.DrawingIdManager.Reserve(anchor.docPr.id);
                    }
                }
                List <CT_Inline> inlineList = ctDrawing.GetInlineList();
                foreach (CT_Inline inline in inlineList)
                {
                    if (inline.docPr != null)
                    {
                        this.Document.DrawingIdManager.Reserve(inline.docPr.id);
                    }
                }
            }

            //// Look for any text in any of our pictures or Drawings
            StringBuilder text         = new StringBuilder();
            List <object> pictTextObjs = new List <object>();

            foreach (CT_Picture pic in r.GetPictList())
            {
                pictTextObjs.Add(pic);
            }
            foreach (CT_Drawing draw in drawingList)
            {
                pictTextObjs.Add(draw);
            }
            //foreach (object o in pictTextObjs)
            //{
            //todo:: imlement this
            //XmlObject[] t = o.SelectPath("declare namespace w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' .//w:t");
            //for (int m = 0; m < t.Length; m++)
            //{
            //    NodeList kids = t[m].DomNode.ChildNodes;
            //    for (int n = 0; n < kids.Length; n++)
            //    {
            //        if (kids.Item(n) is Text)
            //        {
            //            if (text.Length > 0)
            //                text.Append("\n");
            //            text.Append(kids.Item(n).NodeValue);
            //        }
            //    }
            //}
            //}
            pictureText = text.ToString();

            // Do we have any embedded pictures?
            // (They're a different CT_Picture, under the Drawingml namespace)
            pictures = new List <XWPFPicture>();
            foreach (object o in pictTextObjs)
            {
                foreach (OpenXmlFormats.Dml.Picture.CT_Picture pict in GetCTPictures(o))
                {
                    XWPFPicture picture = new XWPFPicture(pict, this);
                    pictures.Add(picture);
                }
            }
        }
Exemple #14
0
 public XWPFHyperlinkRun(CT_Hyperlink1 hyperlink, CT_R Run, IRunBody p)
     : base(Run, p)
 {
     this.hyperlink = hyperlink;
 }
Exemple #15
0
 public XWPFSharedRun(CT_R ctR, IRunBody p)
 {
     this.run    = ctR;
     this.parent = p;
     SetFontFamily("Cambria Math", FontCharRange.None);
 }
Exemple #16
0
        /**
         * @param r the CT_R bean which holds the run.attributes
         * @param p the parent paragraph
         */
        public XWPFRun(CT_R r, IRunBody p)
        {
            this.run = r;
            this.parent = p;

            /**
             * reserve already occupied Drawing ids, so reserving new ids later will
             * not corrupt the document
             */
            IList<CT_Drawing> drawingList = r.GetDrawingList();
            foreach (CT_Drawing ctDrawing in drawingList)
            {
                List<CT_Anchor> anchorList = ctDrawing.GetAnchorList();
                foreach (CT_Anchor anchor in anchorList)
                {
                    if (anchor.docPr != null)
                    {
                        this.Document.DrawingIdManager.Reserve(anchor.docPr.id);
                    }
                }
                List<CT_Inline> inlineList = ctDrawing.GetInlineList();
                foreach (CT_Inline inline in inlineList)
                {
                    if (inline.docPr != null)
                    {
                        this.Document.DrawingIdManager.Reserve(inline.docPr.id);
                    }
                }
            }

            //// Look for any text in any of our pictures or Drawings
            StringBuilder text = new StringBuilder();
            List<object> pictTextObjs = new List<object>();
            foreach (CT_Picture pic in r.GetPictList())
                pictTextObjs.Add(pic);
            foreach (CT_Drawing draw in drawingList)
                pictTextObjs.Add(draw);
            //foreach (object o in pictTextObjs)
            //{
            //todo:: imlement this
            //XmlObject[] t = o.SelectPath("declare namespace w='http://schemas.openxmlformats.org/wordprocessingml/2006/main' .//w:t");
            //for (int m = 0; m < t.Length; m++)
            //{
            //    NodeList kids = t[m].DomNode.ChildNodes;
            //    for (int n = 0; n < kids.Length; n++)
            //    {
            //        if (kids.Item(n) is Text)
            //        {
            //            if (text.Length > 0)
            //                text.Append("\n");
            //            text.Append(kids.Item(n).NodeValue);
            //        }
            //    }
            //}
            //}
            pictureText = text.ToString();

            // Do we have any embedded pictures?
            // (They're a different CT_Picture, under the Drawingml namespace)
            pictures = new List<XWPFPicture>();
            foreach (object o in pictTextObjs)
            {
                foreach (OpenXmlFormats.Dml.Picture.CT_Picture pict in GetCTPictures(o))
                {
                    XWPFPicture picture = new XWPFPicture(pict, this);
                    pictures.Add(picture);
                }
            }
        }
Exemple #17
0
 public XWPFFieldRun(CT_SimpleField field, CT_R run, IRunBody p)
     : base(run, p)
 {
     ;
     this.field = field;
 }
Exemple #18
0
 public XWPFHyperlinkRun(CT_Hyperlink1 hyperlink, CT_R Run, IRunBody p)
     : base(Run, p)
 {
     this.hyperlink = hyperlink;
 }
Exemple #19
0
 public XWPFOMath(CT_OMath oMath, IRunBody p) : base(oMath, p)
 {
 }