Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

ExtendScript: Get all text from a document

$
0
0

Hi all.

 

I have the following task: I need to translate a document into another language using ExtendScript. So, as "input" I have a document with a text/graphics/tables/etc. in Language_1 and a "somehow-separated file", which will contain data about translation into the Language_2. E.g.:

 

Some_text_in_language_1     Some_text_in_language_2

Some_other_text_in_language_1     Some_other_text_in_language_2

 

To get the source text from the document, I've tried to use this:

 

var pgf = doc.MainFlowInDoc.FirstTextFrameInFlow.FirstPgf;

while(pgf.ObjectValid()){

     var test = pgf.GetText(Constants.FTI_String);

     var text, str;

     text = "";

     for (var i=0; i < test.len ; i +=1)

     {

          var str=test[i] .sdata.replace(/^\s+|\s+$/g, '') ; 

          text = text + str;

          PrintTextItem (test[i]);

     }                      

     pgf = pgf.NextPgfInFlow;

}

 

But with this, I can only access the regular text in the document (e.g. the text in tables remains untougched). Is there any way I can the all textual data from specified document? Or maybe, the full list of controls, which can contain it, to iterate throught them and extract it one-by-one? Or maybe there's a better way to solve this problem?

 

Thanks in advance! Any advice would be greatly appreciated.


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>