15 Replies Latest reply on Nov 7, 2011 10:08 AM by John Hawkinson

    How to fix skewed table columns and rows after re-import XML

    ann_y_li

      My question is regarding XML Import in InDesign CS3.

       

      I have a XML that has a table of 5 columns and 5 rows, when I import it into InDesign, the table shows up fine with 5 columns and 5 rows. However when I revise my table to have an additional column, and re-import the XML file, the table gets updated, but instead of with an additional column, it gets 'appended' with an additional row instead (InDesign seems to blindly replace each cell from left to right, top to bottom, and ends up with 6 rows instead). The XML file specifies the number of columns and rows (5 and 5 before, 5 and 6 after), why doesn't InDesign recognize it and automatically add a new column when I re-import the file?  Is this problem fixed in CS5.5? Is there a script to fix this?

       

      Here is an example of my old XML vs new XML:

       

      Old:

      <frame5>

      <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" aid:table="table" aid:trows="5" aid:tcols="5">

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1"></Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2006</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2005</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2004</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2003</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores at beginning of period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">678</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores opened during the period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">36</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">50</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">59</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">79</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores closed during the period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">13</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">9</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">7</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">4</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Total stores at end of period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">869</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>

      </Table>

      </frame5>

       

      New:

      <frame5>

      <Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"

      xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="5" aid:tcols="6">

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1"></Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2007</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2006</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2005</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2004</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">2003</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores at beginning of period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">123</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">678</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores opened during the period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">456</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">36</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">50</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">59</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">79</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Stores closed during the period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">789</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">13</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">9</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">7</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">4</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">Total stores at end of period</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">1368</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">869</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">846</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">805</Cell>

      <Cell aid:table="cell" aid:crows="1" aid:ccols="1">753</Cell>

      </Table>

      </frame5>

        • 1. Re: How to fix skewed table columns and rows after re-import XML
          John Hawkinson Level 5

          I dunno, but I would give it a shot with CALS tables.

          • 2. Re: How to fix skewed table columns and rows after re-import XML
            Andreas Jansson Level 2

            This is bad new to me as well, since I was just leaning towards using this kind of InDesign table, since I can't find out how to tag for images in a CALS table.

             

            I get the same error in InDesign CS4, trying your XML, so this (I presume) bug must have existed for some years. Could anyone try it in CS5.5?

            • 3. Re: How to fix skewed table columns and rows after re-import XML
              John Hawkinson Level 5

              Yes, CS5.5 exhibits the same behavior. It doesn't look like ID really uses the XML aid:tcols/aid:trows after the table is instantiated, which is why this happens.

               

              What about just using tabs and Convert Text to Table?

              • 4. Re: How to fix skewed table columns and rows after re-import XML
                ann_y_li Level 1

                >> What about just using tabs and Convert Text to Table?

                I don't think this is an option for us, the import should not require user to manually apply some "extra steps".

                 

                Can this be achieved by any kind of scripts? XSLT?

                • 5. Re: How to fix skewed table columns and rows after re-import XML
                  John Hawkinson Level 5

                  I don't think this is an option for us, the import should not require user to manually apply some "extra steps".

                   

                  Can this be achieved by any kind of scripts? XSLT?

                  Most people would consider scripts and XSLT to be "extra steps." Can you define a bit more precisely what you mean?

                   

                  As I said initially, I would recommend you try it with CALS tables. Do they not just work?

                   

                  Pretty much anything you can do by hand can be achieved by scripting, so sure.  But if your goal is to autoupdate from the XML, I fear you are going to have some trouble with that... When would the script run and what exactly would it do?

                  • 6. Re: How to fix skewed table columns and rows after re-import XML
                    ann_y_li Level 1

                    >> Most people would consider scripts and XSLT to be "extra steps." Can you define a bit more precisely what you mean?

                    -- What I mean is, right now there is a "workaround" which requires a user to manually add an extra column before re-importing the XML (with an extra column), otherwise the results get skewed. If by providing a script we can simply ask the user to "run" it, it would be a more "acceptable" solution. 

                     

                    Of course if nothing is required from the user other than simply re-importing, then that would be the best solution.

                     

                    Sure we can switch to use "CALS table and see if this works. The question is, why should we need to? In the 2nd XML there is clearly a different "aid:tcols" value, and yet InDesign seems to ignore it and assume the same # of columns? This sounds like an Indesign bug, can someone confirm? Is there any plans to fix this? 

                     

                    I also can't find much documentation on how to update my table to a "CALS table", any examples?

                    • 7. Re: How to fix skewed table columns and rows after re-import XML
                      John Hawkinson Level 5

                      What I mean is, right now there is a "workaround" which requires a user to manually add an extra column before re-importing the XML (with an extra column), otherwise the results get skewed. If by providing a script we can simply ask the user to "run" it, it would be a more "acceptable" solution.  

                      Right. So, one solution would be to use Convert Text to Tables. If you find that works for you, then you can script it.

                      That's why I asked you...

                       

                      Of course if nothing is required from the user other than simply re-importing, then that would be the best solution.

                      Well, one could imagine a script that was attached to the re-import command, or to the link update notification, but probably the first step is to get something that works reasonably well without automating it completely. Especially because triggers to run scripts silently can introduce hard-to-debug problems.

                      Sure we can switch to use "CALS table and see if this works. The question is, why should we need to? In the 2nd XML there is clearly a different "aid:tcols" value, and yet InDesign seems to ignore it and assume the same # of columns? This sounds like an Indesign bug, can someone confirm? Is there any plans to fix this?

                      Not to be snarky, but do you want it to work or not? There are the tools you have and the tools you wish you had, and you can't really do much with the ones you wish you had. I'm kind of assuming you are looking for a solution today, not a solution in 2013.

                       

                      Yes,  I believe two of us have confirmed this appears to be a bug.

                      Plans to fix? Well, we can't really tell you. You could try asking Adobe, but that's not easy information to get out. But you can certainly open a support case at http://adobe.com/go/supportportal and ask. It's not like we have special information here...

                      But you're probably better off filing a bug first, in that same fashion.

                       

                      But let's assume no one had filed the bug. CS6 is expected in the March/April 2012 timeframe. That means that they're probably just putting the finishing touches on it right now, and it's going to be very difficult to fix things in it now. So then the earliest you'd likely get it fixed in CS6.5/CS7/whatever which presumably comes out by 2Q2013, and that's assuming Adobe decides to fix it...

                       

                      I also can't find much documentation on how to update my table to a "CALS table", any examples?

                      Try this thread:

                       

                      Re: Importing a CALS table into InDesign CS3

                      1 person found this helpful
                      • 8. Re: How to fix skewed table columns and rows after re-import XML
                        ann_y_li Level 1

                        Thanks for the "Re: Importing a CALS table into InDesign CS3" link. (I think your link wasn't correct, but I was able to find it here: http://forums.adobe.com/message/3965364)

                         

                        I tried a few Imports / Re-imports using the examples in the thread, including adding an additional column / removing additional column, I see that it works slightly better than the InDesign table we have currently. However, I see that everytime I re-import an XML (even if the only change is an additional character), it would re-organize the column/row lenghs/widths, which doesn't happen with the InDesign tables. I can also forsee that once we switch over to use CALS tables, losing all the column / row sizes would become a problem.

                         

                        I would love to file a bug for this, but I can't seem to find a way. I'm using a volume licence, and it doesn't seem to allow me to "register" my version, which seems to be a mandatory step before you can create a case. I guess I or one of my coworkers can always call them up and ask about this.

                         

                        Thanks for all your help.

                        • 9. Re: How to fix skewed table columns and rows after re-import XML
                          John Hawkinson Level 5

                          Sorry about that. Unfortunately I can't edit the link, but you're right. Some weird cut and paste bug that happens intermittently with the new forum software, I'm afraid.

                           

                          Hmm. Well, I'm not sure what to suggest.

                           

                          In re volume licensing, yes, I feel your pain. You're supposed to have a support contract, or so they tell me. But you can call them up and they'll try to charge your credit card $40 and tell you that they'll credit your (newly created) support account for a single incident when it is a confirmed bug. So pony up the $40 and then as long as you only ever open cases on bugs, you're good-to-go.

                          1 person found this helpful
                          • 10. Re: How to fix skewed table columns and rows after re-import XML
                            Andreas Jansson Level 2

                            ann_y_li wrote:

                             

                            I would love to file a bug for this, but I can't seem to find a way.

                             

                            Hi,

                             

                            There is the bug report form: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

                            You won't get any feedback that way though.

                             

                            Andreas

                            • 11. Re: How to fix skewed table columns and rows after re-import XML
                              John Hawkinson Level 5

                              I emphastically disrecommend the wishform option.

                              Yes, you can do it.

                              But it's nothing like the satisfaction of having a bug number in hand.

                               

                              Also, given the amount of pushback you get from Support before you actually get a bug number in hand, it's hard to believe they actually assign them for items filed in the wishform. That said, if you totally get stuck, let me know and I will file it for you.

                              • 12. Re: How to fix skewed table columns and rows after re-import XML
                                Andreas Jansson Level 2

                                Ah, yes of course even this simple suggestion would have to be "emphastically disrecommended".

                                • 13. Re: How to fix skewed table columns and rows after re-import XML
                                  John Hawkinson Level 5

                                  Ha ha! Of course I meant "emphatically," but it does sound like it could be some weird cross between "emphasis" and "emphatically." A perfectly cromulent word!

                                  • 14. Re: How to fix skewed table columns and rows after re-import XML
                                    ann_y_li Level 1

                                    >> That said, if you totally get stuck, let me know and I will file it for you.

                                    Can I assume this applies to me as well?  We kind of are a little stuck right now, seeing that CALS tables don't really work for us.  It would be so greatly appreciated if you can help us file this.

                                    • 15. Re: How to fix skewed table columns and rows after re-import XML
                                      John Hawkinson Level 5

                                      Can I assume this applies to me as well?  We kind of are a little stuck right now, seeing that CALS tables don't really work for us.

                                      ann_y_li, the offer was directed at you, but I'm afraid you misinterpretted it.

                                      If you make a reasonable effort to file the bug with Adobe and you get stuck, I'm willing to help you. But please do make a reasonable effort. In my mind, that means calling them up and opening a support ticket (and paying $40 for the privilege).

                                      If that doesn't work for you, perhaps send me a PM and I'll see what I can do.

                                      Remeber we're all volunteers on this forum (at least most of us, me included).