Page 1 of 1

org.docx4j.vml.CTTextbox Issue

PostPosted: Wed Jan 25, 2012 4:32 am
by sureshbabubv
Dear All,

I tried adding a textmessage in Textbox, Initially I added it in a plain docx page and got the xml as shown below

Code: Select all
   <v:shapetype id="_x0000_t202" coordsize="21600,21600"
      o:spt="202" path="m,l,21600r21600,l21600,xe">
      <v:stroke joinstyle="miter" />
      <v:path gradientshapeok="t" o:connecttype="rect" />
   <v:shape id="Text Box 195" o:spid="_x0000_s1026" type="#_x0000_t202"
      filled="f" stroked="f">
            <w:p w:rsidR="002E57F9" w:rsidRDefault="0030198C">
                  <w:jc w:val="center" />
                     <w:sz w:val="28" />
                     <w:szCs w:val="19" />


The following code I developed to achive the above

Code: Select all
  public static void addTextBoxContent(String designText) throws Exception {
             //starting a paragraph
                        //starting a run
         CTShape objCTShape = new CTShape();
          org.docx4j.vml.CTTextbox  objCTTextbox = new CTTextbox();
         org.docx4j.wml.CTTxbxContent objCTTxbxContent = new CTTxbxContent();



         Pict pict = wmlFactory.createPict();


but while running the code I am getting the following exception

Code: Select all
[com.sun.istack.internal.SAXException2: unable to marshal type "org.docx4j.vml.CTTextbox" as an element because it is missing an @XmlRootElement annotation]

Please advice me where I am doing the mistake.

Thanks & Regards,
B.V.Suresh Babu.

Re: org.docx4j.vml.CTTextbox Issue

PostPosted: Wed Jan 25, 2012 10:46 am
by jason
Try creating your CTTextbox using the VML object factory.

Re: org.docx4j.vml.CTTextbox Issue

PostPosted: Thu Jan 26, 2012 12:58 am
by sureshbabubv
Hi Jacon,

I tried the same, but getting same exception, but I resolved this one by another way( by using the w:pict tags).

Thanks & Regards,
B.V.Suresh Babu.