8 Replies Latest reply on Aug 20, 2015 3:11 AM by Pickory

    Html snippet insertion

    _Seb_

      Hi,

       

      Im trying to insert some HTML code into a rectangle (a complex "<p>Hi</p>") via scripting. It works,... but I need to manually do an "edit HMTL" in Indesign interface in order to refresh the display.

       

      Any idea ?

       

      Thanks.

        • 1. Re: Html snippet insertion
          Laubender Adobe Community Professional & MVP

          _Seb_ – I can confirm this problem.

           

          But you could set  the viewDisplaySetting to a different value and then again to the old value:

           

          myRectangle.htmlItems[0].htmlContent = "<b>New HTML</b>";
          
          app.documents[0].windows.everyItem().viewDisplaySetting = ViewDisplaySettings.OPTIMIZED;
          app.documents[0].windows.everyItem().viewDisplaySetting = ViewDisplaySettings.HIGH_QUALITY;
          

           

           

          Uwe

          • 2. Re: Html snippet insertion
            Laubender Adobe Community Professional & MVP

            Or, maybe a better idea:

             

            //Set the visibility of the HtmlItem:
            myRectangle.htmlItems[0].visible = false;
            myRectangle.htmlItems[0].visible = true;
            

             

             

            Uwe

            • 3. Re: Html snippet insertion
              Harbs. Level 6

              I'm not seeing this on my end...

              • 4. Re: Html snippet insertion
                _Seb_ Level 1

                Try both solutions without success. But I perform this action with actionscript (CSExtensionBuilder) maybe I'll try with pure javascript.

                • 5. Re: Html snippet insertion
                  Laubender Adobe Community Professional & MVP

                  @_Seb_ – does the display refresh and showing the new HTML-preview, if you go to another page and come back?

                   

                  Uwe

                  • 6. Re: Html snippet insertion
                    Pickory Level 3

                    Hello,

                     

                    Did you solve this one? I seem to have the same problem. It works if I create the HTML item by hand.

                     

                        if ( r.htmlItems.length == 0 )

                        {

                            r.htmlItems.add ( );

                        }

                        r.htmlItems[0].htmlContent = theHTML;

                        r.htmlItems[0].visible = false;

                        r.htmlItems[0].visible = true;

                    It works if I create the HTML item by hand.

                     

                    P.

                    • 7. Re: Html snippet insertion
                      Laubender Adobe Community Professional & MVP

                      Hi Pickory,

                      just tried again with CC 2014.2 where we can get a real good preview in the EPUB Interactivity Preview Panel.

                      The "preview" you are after, the one in the HTML frame, is no preview at all, I think, just a strange representation of rendered HTML.

                      Or not. I experimented a bit without success and finally thought, let's do it the UI way and came up with a strange example.

                      Somehow the contents of an already removed frame I did with ExtendScript or by UI (I can't remember exactly) travelled over partly to a new HTML frame I did in the UI.

                      I did not change its contents. It's just the default one as you can see in the EPUB Interactivity Preview Panel.

                       

                      TryingToInsertHTML.png

                       

                      Uwe

                      • 8. Re: Html snippet insertion
                        Pickory Level 3

                        Hello Uwe

                         

                        I haven’t fully test this.

                         

                            r.contentType = ContentType.GRAPHIC_TYPE;

                         

                        P.