How to place a Xml in selected text frame?

When i set default text frame below code working fine, if i not mention the default text frame is not placing
do {
  // +precondition
                    InterfacePtr<IDocument> document(documentUIDRef, UseDefaultIID());
                    ASSERT(document);
                    if(!document) {
  break;
  // -precondition
  InterfacePtr<ICommand> importCmd(CmdUtils::CreateCommand(kImportXMLFileCmdBoss));
                    ASSERT(importCmd);
  InterfacePtr<IImportXMLData> importXMLData(CreateObject2<IImportXMLData>(kImportXMLDataBoss));
                    ASSERT(importXMLData);
                    if(!importXMLData) {
  break;
                    importXMLData->Set(documentUIDRef.GetDataBase(), contentFile, xmlReferenceWhere, kSuppressUI);
  InterfacePtr<IXMLImportOptions> docXMLOptions( document->GetDocWorkSpace(), UseDefaultIID() );
                    ASSERT(docXMLOptions);
                    if(!docXMLOptions) {
  break;
  InterfacePtr<IXMLImportOptions> importXMLOptions(importXMLData, UseDefaultIID());
                    ASSERT(importXMLOptions);
                    if(!importXMLOptions) {
  break;
                    importXMLOptions->Copy(docXMLOptions);
  InterfacePtr<IPMUnknownData> pmUnknownData(importCmd, UseDefaultIID());
                    ASSERT(pmUnknownData);
                    if(!pmUnknownData)
  break;
                    pmUnknownData->SetPMUnknown(importXMLData);
                    CmdUtils::ProcessCommand(importCmd);
                    ASSERT(err==kSuccess);
          } while(kFalse);
I need to mention frameUIDRef to flow the text in above code.
Please suggest any soluction or idea.

Hi Norio,
Itry using
InterfacePtr<ITextModel> textModel(textModelUIDRef, UseDefaultIID());
                    ASSERT(textModel);
                    if(!textModel) {
  break;
  // -precondition
                    IDataBase* database = textModelUIDRef.GetDataBase();
  InterfacePtr<IIDXMLElement> rootXMLElement(Utils<IXMLUtils>()->QueryRootElement(database));
                    ASSERT(rootXMLElement);
                    if(!rootXMLElement) {
  break;
                    XMLReference rootXMLReference = rootXMLElement->GetXMLReference();
                    int32 indexInParent =  rootXMLElement->GetChildCount();
                    if(indexInParent < 0) {
                              indexInParent = 0;
                    UIDRef rootDocumentUIDRef(database,database->GetRootUID());
                    UIDRef tagUIDRef = this->AcquireTag(rootDocumentUIDRef, tagName);
                    err = Utils<IXMLElementCommands>()->CreateElement(tagUIDRef.GetUID(),
                                                                                                                                              textModelUIDRef.GetUID(),
                                                                                                                                              rootXMLReference,
                                                                                                                                              indexInParent
its not working

Similar Messages

  • How to get paragraph number of selected text in ID CS4

    Hi,
    Can anybody help me how to get paragraph number of selected text in Indesign cs4.
    Thanks,
    Gopal

    Ah, I see -- thanks. Turns out that there's no difference in speed between texts.itemByRange(), characters.itemByRange(),and insertionPoints.itemByRange(). In a document with 170 pages of text, and with the cursor in the last paragraph, the second and third lines, below (and your function), give exactly the same result:
    t = app.selection[0];
    t.parentStory.texts.itemByRange (t.parentStory.insertionPoints[0], t).paragraphs.length;
    t.parentStory.characters.itemByRange (t.parentStory.characters[0], t).paragraphs.length;
    Peter

  • Multiple selected text frame to table

    I am looking for a script that will allow me to select multiple text frames at one time and have the contents in those text frames converted to tables.
    What I have to do now is place the cursor in one text frame, select all, select menu item "convert to table", the defalt dialog appears and I click ok.
    I have ten text frames on a page (for example). The manual process means I have to do the text to table 10 times per page.
    So, I would like a script that will allow me to select all 10 text frames and convert the content of each frame to a table.
    Any suggestions are appreciated.
    RPP

    This should do it:
    if (app.documents.length > 0 && app.selection.length > 0)
      for (i = 0; i < app.selection.length; i++)
        try {app.selection[i].texts[0].convertToTable ("\t", "\r")}
          catch (_) {}
    Peter

  • How do I apply style within a text frame linked object

    I'm selecting the text frame in the object I want to apply an object style
    A script can be written
    within a text frame the linked object (selected text frame)
    how object style is applied

    Hi
    All you need is
    app.selection[0].appliedObjectStyle = app.activeDocument.objectStyles.itemByName ("Trevors Object Style");
    The below snippet will apply the style to all the anchored objects in the selection or document
    var doc = app.properties.activeDocument,
        myOnjectStyle = doc.objectStyles.itemByName ("Trevors Object Style"),
        myObjects, l;
    if (!myOnjectStyle.isValid) {
        alert ("Either add an Object Style Called:\nTrevors Object Style\nOr Make Significant Changes to The Script");
        quit ();
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "^a";
    myObjects = (app.selection && app.selection[0]).findText () || doc.findText ();
    l = myObjects.length;
    while(l--) myObjects[l].textFrames[0].appliedObjectStyle = myOnjectStyle;
    HTH
    Trevor

  • How do I print just a selected text instead of entire page?

    Hello. I have a question about printing selected text. In windows there is an option to highlight a specific text from a let's say a browser window or document. Then you can right click and hit print. When the print window comes up you can select "print selected". Is there a way to do that on Mac OS X?
    Black Macbook Core Duo 2 GHz 2GB ram Mac OS X (10.4.8)

    Try Print Selection
    <http://discussions.apple.com/post!reply.jspa?messageI
    D=4747304>
    Thanks for the reply but it took me a bit of time to figure out how to find that option!
    For those who didn't know either, it's under "Firefox" in the third section of the print window.

  • How to find a word in select text?

    if offer is in select text, i want display some message.
    How can i find select text contains offer using JS?.
    selObj.options[selIndex].text == "%offer%"

    Take a look at javascript's string functions or regular
    expressions for more complex searches. Just remember javascript is
    case sensitive.
    http://www.w3schools.com/jsref/jsref_obj_string.asp
    http://www.w3schools.com/jsref/jsref_obj_regexp.asp

  • How to determine the size of selected text

    Hi
    I'd like to draw a box around some selected text (a textRange), however I can't figure out how to detemine the size or position of the text.  The overall size of a textFrame is possible to find (not sure about position), but when you've got just a few characters selected I don't see any way to get the size or position.  Any ideas?

    You may have to do some testing of your own with this… I tested here and 'think' its OK but could have overlooked something… For me the best way to get this data is to outline the type store the info in a variable then undo the outlining process… You can then continue your script with info in hand… An example that draws a box over each selected character… I cheated with only the one text frame but you can resolve that? You could easy use math.min & math.max to draw around an array of bounds… I didn't bother with a load of tests it expects selected text range as is… have fun…
    #target Illustrator
    textBoxer();
    function textBoxer() {
              var i, doc, sel, start, end, spaceB4, spaceInc, mat, grp, count, boxes;
              doc = app.activeDocument;
              sel = doc.selection;
              start = sel.characterOffset-1; // Not zero based…
              end = start + sel.length;
              doc.selection = null;
              spaceB4 = doc.textFrames[0].contents.substr( 0, start );  // Cheated here you will need to find parent frame…
              mat = spaceB4.match( /\s/g ); // Resolve the lost of white space characters before selection
              mat != null ? spaceB4 = mat.length : spaceB4 = 0;
              spaceInc = doc.textFrames[0].contents.substr( 0, end );  // Here too…
              mat = spaceInc.match( /\s/g ); // Resolve the lost of white space characters in selection
              mat != null ? spaceInc = mat.length : spaceInc = 0;
              grp = doc.textFrames[0].createOutline(); // Items in new group are last to first order
              app.redraw();
              count = grp.compoundPathItems.length;
              boxes = Array();
              for ( i = 0; i < count; i++ ) {
                        boxes.push( grp.compoundPathItems[i].visibleBounds );
              boxes.reverse(); // Fix the order
              app.undo(); // Bounce back…
              app.redraw();
              start = start - spaceB4;
              end = end - spaceInc;
              for ( i = start; i < end; i++ ) {
                                  doc.pathItems.rectangle( boxes[i][1], boxes[i][0], boxes[i][2]-boxes[i][0], -boxes[i][3]- -boxes[i][1], false );
              app.redraw();

  • How to place the xml contents into textframe?(cs2_js)

    after flow the xml into indesign document,i able to get the particular xml element and its contents in a variable.
    i want to know how to get certain range of xml element's contents and how to place that in textframe?
    //for get content
    app.activeDocument.xmlElements.item("header1").contents
    if i place the particular element's contents in xml structure extra tags added at edge
    i want to avoid that duplication also
    thanks in advance
    by
    subha

    Hi,
    Use FM WS_FILE_COPY To FIrst Copy the File to some Location
    and Next Use FM TMP_GUI_DELETE_FILE To Delete the File from Old LOcation.
    Regards
    Bala.M

  • How to increase the length of selection texts

    Hi to all..
    please do a favour......
    My problem is ,I am not able to enter long text in SELECTION TEXTS after certain length ,but we need long texts .So what I have to do to enter long texts..
    plz respond

    Hi Suribabu,
    In SE63 We can increase the length of the text.
    There is one option called Praposal,Edit Icon, There you can increase the length Max 255(see the Data element LXEUNITLIN) of the selection text.
    Regards
    Bhavani

  • How do I create a series of text frames using values from Excel list?

    First of all, this is the very first script I'm attempting to write from scratch. I'm completely green at scripting, and I've picked up a few snippets from Adobe's ID scripting guide, but nothing has really stuck yet relating to this particular objective.
    My supervisor keeps a master list of ad spaces, with the name of the account, how wide the space is, and how tall the space is, all in an Excel sheet. These spaces can number in the hundreds, and I am stuck manually drawing one rectangle for every space, which takes a very long time.
    I'd like to create/have help creating a script that will take these values and "automagically" draw these spaces in the form of text frames, with the width (in columns) and the height (in inches) defined by the values in the master list, as well as the name of each account appearing in the subsequent text frames.
    The script doesn't necessarily need to be able to pull the values straight from the Excel sheet; I can transfer the values to a support text file if needed, or directly into the script, changing it as I need it. A big thing (if it is not able to pull right from an Excel sheet) is that the number of spaces changes weekly, and so do the accounts, and the width and the height. Accordingly, it would be ideal if the values from the sheet could be changed easily, so as to create a new set of spaces as needed.
    Positioning for each space is not crucial, only height and width. If they all appear on top of each other on the same page, that will be a result for me. The main idea is to not have to draw them all manually, one by one.
    To me, this sounds like a tall order, but hopefully some experienced scripters out there can assist me, as I wish to become experienced as well.
    So, the TL;DR version:
    - Script needs to draw a series of text frames.
    - Text frames dimensions need to be defined by width and height values from Excel sheet.
    - Text frames must have account name as contents (from account names in Excel sheet).
    - Accounts, width and height change every week in the Excel sheet, so must be relatively easy to exchange all of the values.
    - The width values are on the Excel sheet as columns. It would be ideal if the script could convert those numbers into multiples of columns as needed.
    - (Optional) Script can pull values directly from Excel sheet.
    - (Optional) Script can define text frame fill color as gray. (If it works as I think it will, I could just select all the resulting text frames myself and set them all to gray at once... I'm not that lazy )
    Thanks in advance to whomever can assist in any possible way, even if it is just a push in the right direction. This script will save 1-2 hours of tedium every week.

    Sound like the perfect thing for InDesign Scripting.
    I would copy the Excel contents into a text file, to get a format that is easily read from InDesign, and there will automatically be a TAB for each "cell" just using copy/paste.
    Here is a piece of code, that you perhaps could go on with (adding variable to change pages and location on page, and other stuff).
    The readFileLineByLine function, can be easily re-used with any function using "callback". You simply supply the function to it, that you want to be executed for every line of text that is read:
    const COLUMN_WIDTH = 2; // Define the column width in inch
    var pageIndex;
    var textFramesExported; // not implemented.
    // Add a new dokument. Set myDoc to app.activeDocument to use
    // the current document instead of creating a new one.
    var myDoc = app.documents.add();
    // The doSomethingWithTextRow function is called upon for every line of text read.
    readFileLineByLine('c:\\test.txt', doSomethingWithTextRow);
    function doSomethingWithTextRow(row){
        // We expect the text line to be TAB separated (\t = TAB). We get that from just copying the contents of an
        // excel file into a text document.
        var cells = row.split('\t');
        var companyName = cells[0]; // The Company name in the first slot of the array
        var width = COLUMN_WIDTH * cells[1];
        var height = cells[2];
        // Create a new text frame for every row handled
        if (pageIndex==undefined) pageIndex = 0; // Count up when you have exported a number of texts, I leave this for you to do.
        var newTextFrame = myDoc.pages[pageIndex].textFrames.add();
        newTextFrame.contents = companyName;
        // The text frame is created in the top left corner.
        newTextFrame.geometricBounds = [0, 0, height + ' in', width + ' in']; // Top, Left, Bottom, Right
        // You might want to move the textframes to other positions, keeping track of how many you put out per page.
        newTextFrame.move( [10, 10] );
    function readFileLineByLine(path, callbackFn){
        var myFileIn = new File(path);
        if (File.fs == 'Windows'){
            // This was probably added to recognize UTF-8 (even without its start marker?)
            myFileIn.encoding = 'UTF-8';
        myFileIn.open('r');
        var myEncoding = myFileIn.encoding;
        try{
            if (!myFileIn.exists){
                throw('Missing file: ' + myFileIn.fsName)
            var ln = '';
            while(!myFileIn.eof){
                // Read the lines from the file, until an empty line is found [now as a remark].
                ln = myFileIn.readln()
                // if(ln !='' && ln!='\n'){
                   // Call the function supplied as argument
                   callbackFn(ln);
        }catch(e){
            alert(e);
            gCancel = true;
        finally{
            myFileIn.close();
    The file in C:\ in my example was saved as UTF-8 and looks like this (showing hidden characters):
    Message was edited by: Andreas Jansson

  • How do I create a series of text frames from a list of files?

    And I'm back again.
    This time, I'm wondering how I can use JavaScript to place a series of text frames from a list of files, preferably with the ability to specify criteria before running the script.
    Here's the details: I work for a newspaper and I lay out stories for the pages (in addition to the other part of my job, laying out ad spaces, as detailed in a previous thread, for which I requested another script, thanks Andreas and Jongware ). The file names for the stories are labeled for the section they go in, like L- for Life, C- for Comment, S- for Sports, etc.
    I'd like to create a script that asks for a criteria in a text box (where I can type L-, C-, S- or whatever else I need) and then places all of the stories, in a specified directory, whose file names match what was typed in the box, one text frame for each.
    I can't rightly tell if this is a simpler or more difficult script to write out, but I plan on putting research into it as usual so I can develop it myself. However, I figured it would be more efficient to ask first, then research, so that while I'm researching, I can refer to the opinions of my fellow forumites, and/or the mods.
    Thanks again for any assistance offered.

    And I'm back again.
    This time, I'm wondering how I can use JavaScript to place a series of text frames from a list of files, preferably with the ability to specify criteria before running the script.
    Here's the details: I work for a newspaper and I lay out stories for the pages (in addition to the other part of my job, laying out ad spaces, as detailed in a previous thread, for which I requested another script, thanks Andreas and Jongware ). The file names for the stories are labeled for the section they go in, like L- for Life, C- for Comment, S- for Sports, etc.
    I'd like to create a script that asks for a criteria in a text box (where I can type L-, C-, S- or whatever else I need) and then places all of the stories, in a specified directory, whose file names match what was typed in the box, one text frame for each.
    I can't rightly tell if this is a simpler or more difficult script to write out, but I plan on putting research into it as usual so I can develop it myself. However, I figured it would be more efficient to ask first, then research, so that while I'm researching, I can refer to the opinions of my fellow forumites, and/or the mods.
    Thanks again for any assistance offered.

  • How to disable Incopy option for a text frame

    Hi All,
    I encounter a document contains a lot of text boxes out of them one has a strange textframe. On right click this textframe I am unable to view 'Incopy' option.
    Isn't it strange?
    Does anyone know how to do it ?
    Please help.
    Thanks,
    D

    Hi Peter,
    I have tried to recover the document as suggested in the post you refere. My problem is still same.
    I figured out that, the story is bound to a xml structure with lots of tags according to the xml structure. If I do 'untag frame' then I am able to export this frame as Incopy story. Still I didn't know what exactly is the issue. As I am able to export other text frames which has tagged content.
    Is it related with tagged content which is tightly bound with xml tags ? Any ideas ??

  • How to determine column inches in a text frame with intersecting frames?

    I am trying to write a script to determine how much text would fit in a text frame before actually having the text. If the frame has no run-around areas intruding on the frame it is the simple depth of the frame. Is there an easy way to determine the area of the frame with the obstructed areas subtracted?

    Maybe you could fill text frame with placeholder text:
    myTextFrame.contents = TextFrameContents.placeholderText;
    Hope that helps.
    tomaxxi
    http://indisnip.wordpress.com/

  • Selection text frame in linked text frame remove

    I chose in the text frame the linked text frames
    get out of text and I want to delete a text frame
    Is it possible that a command letter
    same thing selecting the external can

    Ok. Try now,
    var doc = app.activeDocument;  
    app.findGrepPreferences = app.changeGrepPreferences = null;  
    app.findGrepPreferences.findWhat = "~a";  
    var found = app.selection[0].findGrep();  
    for(var i =found.length-1;i>=0;i--)  
            var ip = found[i].insertionPoints[0];  
            if(found[i].allPageItems[0] instanceof TextFrame) 
                    var cont = found[i].allPageItems[0].texts[0].duplicate(LocationOptions.AFTER,ip);  
                    found[i].remove();  
    Regards,
    Chinna

  • How can i find numberedList in a text frame?

    Hi,
    I need to find the numberedList in a text frame. so that i have written a script. Syntax is given below.
    app.findTextPreferences = NothingEnum.nothing
    app.findTextPreferences.bulletsAndNumberingListType = app.findTextPreferences.bulletsAndNumberingListType.ListType.numberedList;
    var res = app.activeDocument.textFrames[0].parentStory.find();
    alert(res.length)
    But it is not working. How can i write it?
    Regards,
    Subha

    app.findTextPreferences.bulletsAndNumberingListType = ListType.numberedList
    is I think the right syntax for the second statement.
    Dave

Maybe you are looking for

  • Firefox 10.0 - Google Gmail Folders and Messages no longer work

    I'm running Vista Home, on a laptop. This problem started about 4 days ago and no new applications had been downloaded or added prior to this problem occurring. Whenever I try to open a folder of messages within my Google Gmail accounts, the list of

  • Unable to print with new installation of Adobe Reader X

    Yesterday I installed Adobe Reader X on my Dell laptop running Windows XP.  After installing, I was unable to print to a HP Laserjet 4700 printer (only printer I tried).  I rebooted my laptop and tried to repair Adobe Reader and I still can't print. 

  • AddChild not working with library clip (attachMovie AS2 migration)

    Hello,    I'm having a problem adding a library clip to my stage I can do no problem if I have a testFLV.fla that has a library clip called test_clip with the linkage set to: com.attach_clips.Clip. import com.app.views.mediaDisplay; import com.attach

  • JPanel that close the parent JFrame

    Hello. I'm puzzled... how can I close a JFrame from the JPanel it contains? I mean: I have a Form that extends JFrame. In this form there's a JPanel, which has a BorderLayout. In the South part of the BorderLayout there's a JPanel (BoxLayout) that co

  • Calling a std user exit from a user defined user exit

    hi I have a standard User Exit. I want to call it from a User Exit created by me something like zaaabbbb. Can you please tell me the procedure how to do it ?