Exemple #1
0
        public static CT_Picture Parse(XmlNode node, XmlNamespaceManager namespaceManager)
        {
            if (node == null)
            {
                return(null);
            }
            CT_Picture ctObj = new CT_Picture();

            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.LocalName == "movie")
                {
                    ctObj.movie = CT_Rel.Parse(childNode, namespaceManager);
                }
                else if (childNode.LocalName == "control")
                {
                    ctObj.control = CT_Control.Parse(childNode, namespaceManager);
                }
                else if (childNode.Prefix == "o")
                {
                    ctObj.ItemsElementName.Add(ItemsChoiceType9.office);
                    ctObj.Items.Add(childNode);
                }
                else if (childNode.Prefix == "v")
                {
                    ctObj.ItemsElementName.Add(ItemsChoiceType9.vml);
                    ctObj.Items.Add(childNode);
                }
            }
            return(ctObj);
        }
Exemple #2
0
 public static CT_Picture Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Picture ctObj = new CT_Picture();
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "movie")
             ctObj.movie = CT_Rel.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "control")
             ctObj.control = CT_Control.Parse(childNode, namespaceManager);
         else if(childNode.Prefix == "o")
         { 
             ctObj.ItemsElementName.Add(ItemsChoiceType9.office);
             ctObj.Items.Add(childNode);
         }else if(childNode.Prefix=="v")
         {
             ctObj.ItemsElementName.Add(ItemsChoiceType9.vml);
             ctObj.Items.Add(childNode);
         }
     }
     return ctObj;
 }
Exemple #3
0
        private static void CreateWaterMark(XWPFDocument doc, string headerText, string imageUrl = null)
        {
            if (doc.Document.body.sectPr == null)
            {
                doc.Document.body.sectPr = new CT_SectPr();
            }
            CT_SectPr m_SectPr = doc.Document.body.sectPr;

            CT_Hdr header = new CT_Hdr();
            //header.AddNewP().AddNewR().AddNewT().Value = headerText;
            var paragraph = header.AddNewP();

            var ppr = paragraph.AddNewPPr();

            ppr.AddNewPStyle().val = "a3";
            ppr.AddNewJc().val     = ST_Jc.right;

            var r = paragraph.AddNewR();

            r.AddNewRPr().AddNewNoProof();

            CT_Picture pict = r.AddNewPict();

            CT_Shapetype shapetype = new CT_Shapetype();

            shapetype.id        = ("_x0000_t136");
            shapetype.coordsize = ("21600,21600");
            shapetype.spt       = (136);
            shapetype.adj       = ("10800");
            shapetype.path2     = ("m@7,0l@8,0m@5,21600l@6,21600e");
            CT_Formulas formulas = shapetype.AddNewFormulas();

            formulas.AddNewF().eqn = ("sum #0 0 10800");
            formulas.AddNewF().eqn = ("prod #0 2 1");
            formulas.AddNewF().eqn = ("sum 21600 0 @1");
            formulas.AddNewF().eqn = ("sum 0 0 @2");
            formulas.AddNewF().eqn = ("sum 21600 0 @3");
            formulas.AddNewF().eqn = ("if @0 @3 0");
            formulas.AddNewF().eqn = ("if @0 21600 @1");
            formulas.AddNewF().eqn = ("if @0 0 @2");
            formulas.AddNewF().eqn = ("if @0 @4 21600");
            formulas.AddNewF().eqn = ("mid @5 @6");
            formulas.AddNewF().eqn = ("mid @8 @5");
            formulas.AddNewF().eqn = ("mid @7 @8");
            formulas.AddNewF().eqn = ("mid @6 @7");
            formulas.AddNewF().eqn = ("sum @6 0 @5");

            CT_Path path = shapetype.AddNewPath();

            path.textpathok    = (NPOI.OpenXmlFormats.Vml.ST_TrueFalse.t);
            path.connecttype   = (NPOI.OpenXmlFormats.Vml.Office.ST_ConnectType.custom);
            path.connectlocs   = ("@9,0;@10,10800;@11,21600;@12,10800");
            path.connectangles = ("270,180,90,0");

            CT_TextPath shapeTypeTextPath = shapetype.AddNewTextpath();

            shapeTypeTextPath.on       = (NPOI.OpenXmlFormats.Vml.ST_TrueFalse.t);
            shapeTypeTextPath.fitshape = (NPOI.OpenXmlFormats.Vml.ST_TrueFalse.t);

            CT_Handles handles = shapetype.AddNewHandles();
            CT_H       h       = handles.AddNewH();

            h.position = ("#0,bottomRight");
            h.xrange   = ("6629,14971");

            NPOI.OpenXmlFormats.Vml.Office.CT_Lock lock1 = shapetype.AddNewLock();
            lock1.ext       = (ST_Ext.edit);
            lock1.text      = NPOI.OpenXmlFormats.Vml.Office.ST_TrueFalse.t;
            lock1.shapetype = NPOI.OpenXmlFormats.Vml.Office.ST_TrueFalse.t;

            CT_Shape shape = new CT_Shape();

            shape.id    = ("PowerPlusWaterMarkObject" + "1109904797");
            shape.spid  = ("_x0000_s206" + (4 + "1"));
            shape.type  = ("#_x0000_t136");
            shape.style = ("position:absolute;margin-left:0;margin-top:0;width:415pt;height:207.5pt;z-index:-251654144;mso-wrap-edited:f;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin");
            //shape.wrapcoords = ("616 5068 390 16297 39 16921 -39 17155 7265 17545 7186 17467 -39 17467 18904 17467 10507 17467 8710 17545 18904 17077 18787 16843 18358 16297 18279 12554 19178 12476 20701 11774 20779 11228 21131 10059 21248 8811 21248 7563 20975 6316 20935 5380 19490 5146 14022 5068 2616 5068");

            shape.fillcolor = ("#ed7d31 [3205]");
            shape.stroked   = (NPOI.OpenXmlFormats.Vml.ST_TrueFalse.@false);

            shape.AddNewFill().opacity = ".5";
            CT_TextPath shapeTextPath  = shape.AddNewTextpath();

            shapeTextPath.style   = ("font-family:&quotYu Gothic UI&quot");
            shapeTextPath.@string = ("吴润杰水印");

            // pict.Items.Add(shapetype);
            //pict.Set(shapetype);
            pict.Set(shape);
            //pict.Set(group);


            XWPFRelation Hrelation = XWPFRelation.HEADER;
            XWPFHeader   docHeader = (XWPFHeader)doc.CreateRelationship(Hrelation, XWPFFactory.GetInstance(), doc.HeaderList.Count);

            docHeader.SetXWPFDocument(doc);
            //设置页眉
            docHeader.SetHeaderFooter(header);
            CT_HdrFtrRef m_HdrFtr2 = m_SectPr.AddNewHeaderReference();

            m_HdrFtr2.type = ST_HdrFtr.@default;
            m_HdrFtr2.id   = docHeader.GetPackageRelationship().Id;
        }
Exemple #4
0
 public CT_NumPicBullet()
 {
     this.pictField = new CT_Picture();
 }
Exemple #5
0
 public CT_NumPicBullet()
 {
     this.pictField = new CT_Picture();
 }