docx - Identify table ID in microsoft word -


there lots of table in word document. want uniquely identify table microsoft offfice doesn't provide unique identifier(id) them. there way identify microsoft word table uniquely?

problem:
user provides me word file tables. have convert them images. if user provides me same file content of table has been updated have update image. delete , again generate image not worked in case because can't change name of image first assign it.

what tried.

  1. generate xml of word doc , there id or unique identifier. no such thing exists.
  2. look @ table properties 1 field alt text still not relible because user can change it.

this how table looks in xml (3*3):

<w:tbl>             <w:tblpr>                 <w:tblstyle w:val="grilledutableau"/>                 <w:tblw w:type="auto" w:w="0"/>                 <w:tbllook w:firstcolumn="1" w:firstrow="1" w:lastcolumn="0" w:lastrow="0" w:nohband="0" w:novband="1" w:val="04a0"/>             </w:tblpr>             <w:tblgrid>                 <w:gridcol w:w="3070"/>                 <w:gridcol w:w="3071"/>                 <w:gridcol w:w="3071"/>             </w:tblgrid>             <w:tr w:rsidr="00153204" w:rsidtr="00153204">                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3070"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3071"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3071"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>             </w:tr>             <w:tr w:rsidr="00153204" w:rsidtr="00153204">                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3070"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3071"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3071"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>             </w:tr>             <w:tr w:rsidr="00153204" w:rsidtr="00153204">                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3070"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3071"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>                 <w:tc>                     <w:tcpr>                         <w:tcw w:type="dxa" w:w="3071"/>                     </w:tcpr>                     <w:p w:rsidr="00153204" w:rsidrdefault="00153204"/>                 </w:tc>             </w:tr>         </w:tbl> 

they ids here, these ids change if user adds table, moves it, ...

what add identifier yourself:

add particular replacement string tables (for example id:1)

this adds id in w:tblcaption attribute:

    <w:tblpr>         <w:tblstyle w:val="grilledutableau"/>         <w:tblw w:type="auto" w:w="0"/>         <w:tbllook w:firstcolumn="1" w:firstrow="1" w:lastcolumn="0" w:lastrow="0" w:nohband="0" w:novband="1" w:val="04a0"/>         <w:tblcaption w:val="id:1"/>     </w:tblpr> 

to add caption in word: right-click on table->properties->text/replacement

put text element before each table want identify

this adds following xml before table

    <w:p w:rsidr="006b0cc1" w:rsidrdefault="006b0cc1">         <w:r>             <w:t>id :1</w:t>         </w:r>         <w:bookmarkstart w:id="0" w:name="_goback"/>         <w:bookmarkend w:id="0"/>     </w:p> 

i go first possibility it's easy read properties , inside table, have parse table elements.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -