1 Reply Latest reply on Jan 16, 2013 10:35 AM by rrjohnson1985

    HtmlItem.HtmlContent Issue

    rrjohnson1985

      I'm new to InDesign and InDesign Server CS6.  As a small proof of concept, I'm trying to create an InDesign template with an HtmlItem in the document, which has not been a problem.  I am, however, having issues when trying to edit the value of the HtmlItem.HtmlContent using the COM library or the JavaScript SDK with InDesign Server.  If I run the script directly in the InDesign client, everything works fine.

       

      My snippet of my JS script is below:

       

              // get the rectangle           var txtHtml = myPage.rectangles.itemByName("txtHtml");           if(txtHtml.htmlItems.length > 0){                     for(var i = 0; i < txtHtml.htmlItems.length; i++){                               txtHtml.htmlItems[i].htmlContent = "test";                    // strange, this works with InDesign client app, but not from InDesign Server                     }           }

       

      When this runs using the COM library's DoScript function, I end up with the following exception in Visual Studio:

           The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

       

      If I try to set the HtmlItem.HtmlContent directly using the COM library, I get the same error (note, I can see my template text in the HtmlContent property while debugging).

       

      Also, I haven't seen any other issues when setting the value of other InDesign elements using the JS SDK, such as a TextFrame's contents.

       

      Is this a bug, or am I doing something wrong?

       

      Thanks!