4 Replies Latest reply on Dec 21, 2015 3:11 AM by sarfrazm7834471

    Importing a CALS table into InDesign CS3

    Sven_P

      Greetings all,

       

      According to the user documentation, specifically the one on InDesign + XML, it should be a breeze to import a XML CALS table. It's not, and so far I have no success.

       

      The XML file is valid and I am positively sure the table is a CALS table. When I import it, the table shows up in the Structure pane. So far, so good. I then drag and drop the table from the Structure pane onto the page. This does not create a table, but rather many lines of differently indented paragraphs, XML "brackets". So the content is there allright, but it is not rendered as a table.

       

      In Adobe's "Adobe InDesign CS3 and XML: A Technical Reference" it says:

       

      When you import an XML file, any table that follows either the CALS table model or the InDesign table model is automatically rendered as a table in InDesign.

       

      Not quite true. It also says about the "Import CALS table as InDesign tables" checkbox:

       

      Tables in the XML source file that follow the CALS specification are converted to InDesign tables during import.

       

      Not quite true either. Any hints? Surely this cannot be rocket science?

       

      Best wishes,

      Sven

        • 1. Re: Importing a CALS table into InDesign CS3
          John Hawkinson Level 5

          Please reduce your CALS table to a few rows and post it here (use the Advanced Editor and >> XML Syntax Highlighting). I've had CALS tables work just fine, though I don't have have any samples in front of me. Well, OK, in a thread from April I used:

           

          <root>
          <table><tgroup cols="2">
            <colspec colwidth="0.5in"/>
            <tbody>
              <row><entry>one</entry><entry>two</entry></row>
            </tbody>
          </tgroup></table>
          </root>
          
          

           

          Perhaps that helps.

          • 2. Re: Importing a CALS table into InDesign CS3
            Sven_P Level 1

            Hello,

             

            Thanks.

             

            Yes, that worked fine. But the small XML file below, containing some titles and a table, does not work. I assumed that I could drag and drop the <informaltable> element onto the page and get a rendered table.

             

            <?xml version="1.0" encoding="utf-8"?>

            <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">

            <article lang="en">

              <articleinfo>

                <pubsnumber>Some number</pubsnumber>

                <releaseinfo>Another number</releaseinfo>

                <title>A title</title>

              </articleinfo>

              <informaltable frame="all" rowsep="1" colsep="1">

                <tgroup cols="2">

                  <colspec colname="col_1" colwidth="50*" />

                  <colspec colname="col_2" colwidth="50*" />

                  <thead>

                    <row>

                      <entry align="left" valign="top" namest="col_1" nameend="col_2">

                        Some heading here

                      </entry>

                    </row>

                  </thead>

                  <tbody>

                    <row>

                      <entry align="left" valign="top">

                        Some content in left cell

                      </entry>

                      <entry align="left" valign="top">

                        Some content in right cell

                      </entry>

                    </row>

                    <row>

                      <entry align="left" valign="top">

                        Some content in left cell

                      </entry>

                      <entry align="left" valign="top">

                        Some content in right cell

                      </entry>

                    </row>

                   </tbody>

                </tgroup>

              </informaltable>

            </article>

             

            Best wishes,

            Sven

            • 3. Re: Importing a CALS table into InDesign CS3
              John Hawkinson Level 5

              Yes, that worked fine. But the small XML file below, containing some titles and a table, does not work. I assumed that I could drag and drop the <informaltable> element onto the page and get a rendered table.

              Why would you think that? If you rename your <informaltable> to a <table> then your file works fine for me.

              • 4. Re: Importing a CALS table into InDesign CS3
                sarfrazm7834471 Level 1

                You can try it===========>>

                This is the XML File data.......

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <table>
                     <label>TABLE 4-3</label>
                     <caption id="cap0110">
                         <simple-para id="sp0115">Estimated ME Requirements for Adult Psittacines in Various Environments and Activity Levels</simple-para>
                     </caption>
                     <table frame="none"><tgroup cols="2">
                         <colspec colname="col1" colnum="1" colwidth="50%"/>
                         <colspec colname="col2" colnum="2" colwidth="50%"/>
                         <thead>
                             <row>
                                 <entry>Management Scenario</entry>
                                 <entry>ME Requirement (kcal/day)</entry>
                             </row>
                         </thead>
                         <tbody>
                             <row>
                                 <entry>Indoor cage</entry>
                                 <entry>154.6 × (BW in kilograms)<sup>0.73</sup></entry>
                             </row>
                             <row>
                                 <entry>Indoor aviary</entry>
                                 <entry>176.6 × (BW in kilograms)<sup>0.73</sup></entry>
                             </row>
                             <row>
                                 <entry>Outdoor aviary in warm/hot environment</entry>
                                 <entry>203.9 × (BW in kilograms)<sup>0.73</sup></entry>
                             </row>
                             <row>
                                 <entry>Outdoor aviary in cold environment</entry>
                                 <entry>226.1 × (BW in kilograms)<sup>0.73</sup></entry>
                             </row>
                             <row>
                                 <entry>Free ranging</entry>
                                 <entry>229.2 × (BW in kilograms)<sup>0.73</sup></entry>
                             </row>
                         </tbody>
                     </tgroup>
                </table></table>

                ====================================


                This is working Properly...


                #target indesign

                var doc = app.activeDocument;

                var myFile = File.openDialog("Select XML file");

                doc.importXML(myFile);