How text of text block selected?

Hello

I have problem to flow a text of the text selected in the next block.

The code below insert only on the selected image and does not flow to nextframe

Please suggest any idea to go forward.

IdFichier picFile;

picFile. SetPath (WideString(filepath. GrabCString()));

TextFrame UIDREF parentUIDRef

InterfacePtr<IHierarchy> hierarchy (parentUIDRef, UseDefaultIID());

Assert (hierarchy);

if (! hierarchy) {

  break

}

InterfacePtr<> ITransform transform(parentUIDRef, UseDefaultIID());

Assert (transform);

if (transform is Nile) {

  break

}

ItemGeometry InterfacePtr<IGeometry> (parentUIDRef, IID_IGEOMETRY);

PParentTransform InterfacePtr<ITransform> (parentUIDRef, IID_ITRANSFORM);    / / get the boss of transformation

PMRect pRC = itemGeometry->GetPathBoundingBox(InnerToPasteboardMatrix(pParentTransform));

PMPointList points (2);

PMPoint StartPoint = PMPoint(pRC. Left(), People's Republic of China. Back to top ());

PMPoint Point endpoint = PMPoint(pRC. Law(), People's Republic of China. Bottom ());

points. push_back (Starting point);

points. push_back (Evaluation criteria);

/ / Create kImportAndPlaceCmdBoss.

InterfacePtr<ICommand> importAndPlaceCmd (CmdUtils:kImportAndPlaceCmdBossCreateCommand());

Assert (importAndPlaceCmd! = nil);

if (importAndPlaceCmd is nil) {

  break

}

/ / Implement interfaces of the control data.

PlacePIData InterfacePtr<IPlacePIData> (importAndPlaceCmd, UseDefaultIID());

Assert (placePIData! = nil);

if (placePIData is nil) {

  break

}

placePIData->Set(parentUIDRef, & points, kFalse);

URI tmpURI;

Utils<IURIUtils> ()->IDFileToURI(picFile, tmpURI);

InterfacePtr<IImportResourceCmdData> importResourceCmdData (importAndPlaceCmd, IID_IIMPORTRESOURCECMDDATA); / / No kDefaultIID

Assert (importResourceCmdData! = nil);

if (importResourceCmdData is nil) {

  break

}

importResourceCmdData->Set(parentUIDRef. GetDataBase(), tmpURI, K2:kMinimalUI kTrue kTrue, kTrue, kFalse);

/ / Process the command.

if (CmdUtils:ProcessCommand(importAndPlaceCmd)! = kSuccess) {

ASSERT_FAIL() 'kImportAndPlaceCmdBoss failed');

  break

}

/ / Get a reference to the structure created to the appellant.

const UIDList& outItemList = importAndPlaceCmd->GetItemListReference();

Assert (outItemList. Length () > 0);

if (! (outItemList. Length () > 0)) {

  break

}

/ / The framework for text content, we have formatted.

InterfacePtr<ICommand> fitFrameToContentCmd (CmdUtils:kFitFrameToContentCmdBossCreateCommand());

Assert (fitFrameToContentCmd! = nil);

if (fitFrameToContentCmd is nil) {

  break

}

fitFrameToContentCmd->SetItemList(parentUIDRef);

if (CmdUtils:ProcessCommand(fitFrameToContentCmd)! = kSuccess) {

ASSERT_FAIL() 'kFitFrameToContentCmdBoss failed');

  break

}

Can you provide/mention any sample?

Tags: InDesign

Similar Questions

  • How to get the text block, given anchor (~ a)

    I need to dynamically position anchored with anchor text blocks (but the relative position will be different for each anchor). If I grep ~ i can get the anchor marker - how to get the text block once I got this marker?

    Thank you

    The marker "anchor" is a character of "simple".

    So you can do the following if you have identified the character (and in this example selected it):

    //Start with an "Anchor Marker" selected:
    var myCharacter = app.selection[0];
    
    if (myCharacter.texts[0].textFrames.length == 1){
    
    var myAnchoredTextFrame = myCharacter.texts[0].textFrames[0];
        //do something with the anchored text frame:
        myAnchoredTextFrame.fillColor = "Yellow";
    
        };
    

    You can set the myCharacter variable differently, if you know the index of the character according to his history of parent.

    Or if you have found the character as part of a search GREP or TEXT by ExtendScript (JavaScript).

    Uwe

  • How to divide the text block to separate text frames each for a single line.

    I mean the same as a script of the splitstory soon, but I first have to draw all the lines of text in the separate text block.

    How to copy for example consistent with 10 lines of text to separate the 10 images and then divided.

    Dropbox - screen.jpg

    Hello

    Try this,

    var doc = app.activeDocument,
        sel = doc.selection[0],
        _lines = sel.parent.lines,
        txfm = sel.parentTextFrames[0],
        gb = txfm.geometricBounds;
    for(var i =_lines.length-1;i>0;i--)
    {
            var nextframe = txfm.parentPage.textFrames.add({geometricBounds:[_lines[i-1].baseline,gb[1],_lines[i].baseline,gb[3]]});
            nextframe.textFramePreferences.firstBaselineOffset =  FirstBaseline.LEADING_OFFSET;
            txfm.nextTextFrame = nextframe;
        }
    txfm.geometricBounds = [gb[0],gb[1],_lines[0].baseline,gb[3]];
    
    for(var i =sel.parent.textContainers.length-1;i>=0;i--)
    {
            sel.parent.textContainers[i].duplicate();
        }
    for(var i =sel.parent.textContainers.length-1;i>=0;i--)
    {
            sel.parent.textContainers[i].remove();
        }
    

    Kind regards

    Cognet

  • How to select multiple lines of text (without selecting all the text) within a title? (Holding Cmd does not work)

    I need to select several lines of text (in the various sections of the text) within a title without selecting any text. Holding Cmd like you would in other applications does not work, and now Shift selects all. Does anyone have a solution?

    Thank you.

    YYou cannot select several segments of text in a text block.

  • How to put a new line in the text block using jsx?

    Hello guys,.

    I am concatenating the content of the text block using two JSX, but I want separator as a new line. I have tried \n but does not work please help how to do that.

    var  seperator = "\n" 
    frame1.textItem.contents + seperator + text;
    

    Hi UpendraSengarr,

    Try this:

    var frame1 = app.activeDocument.activeLayer;
    var  seperator = "\r";
    frame1.textItem.contents = frame1.textItem.contents + seperator + "text";
    

    Have fun

  • How to bind the text blocks between pages?

    Hello

    I searched all autour for this, and I'm guessing that the answer could be so simple that no tutorial it doesn't even mention:

    How can I link the blocks of text between pages? I made a block of text in each master page and then connected one left with the one on the right. Indeed, all of the text in the document is linked from the page on the left of the right-hand page. But how do I link the page on the right with the following two pages 'below' in the document?

    If I'm not clear, here is another attempt to explain: I'm going to insert a lot of text in a document, and I already know the size and the type of text block, I want the text inserted. When I put the text in the left side, it connects (goes on) the block of text on the right side. But it stops there. So I have to manaully through both pages, which connects the right page "at the top" with the left 'below', page by clicking on the image by clicking on the small arrow in the lower right corner, and clicking on the next page below. There must be a way to organize it in master pages or in some other way?

    Thanks in advance for helping me with this problem of small size, but huge!

    Best

    Kim

    Two things...

    For "automatic formatting" to work with Captain linked frames page, you must NOT release the Master frame before placing the text, and you must click inside the image area, not any sort of guide.

  • C# / JavaScript how to set the primary text block?

    Hello

    I'm working with InDesign scripting API with c# for my work. I'm new to both the InDesign scripting API and using InDesign as well.

    I am building a gap of master, with blocks of text so that the text block on the left page of the cheese would pass in the block of text on the right page.


    I read there is the option block of primary text for the master spread, but I can't seem to understand how to use it.

    Is there someone who could show me an example of script code to define the framework of primary text for a master page/spread?


    Here is the code I have for now.

    The question I have is in line 53, where when I try to run it, it gives me a very generic error 'Invalid object for this request.', which leads me to believe I'm doing it wrong.

            public static byte[] CreatePageBasedOnCreatedMasterSpread(string savePath)
            {
                Application application = ActivateInDesign();
    
    
                // Create new document
                application.Documents.Add(true, application.DocumentPresets.FirstItem());
    
    
                // Get active document and change some settings
                Document document = application.ActiveDocument;
                document.DocumentPreferences.FacingPages = true;
                document.DocumentPreferences.PageWidth = 210;
                document.DocumentPreferences.PageHeight = 297;
    
    
                document.DocumentPreferences.CreatePrimaryTextFrame = true;
                document.TextPreferences.SmartTextReflow = true;
    
    
                MasterSpread masterSpread = document.MasterSpreads.Add();
                masterSpread.BaseName = "CustomMasterSpread";
                masterSpread.NamePrefix = "AC";
    
    
                //Set the document's ruler origin to page origin. This is very important
                //--if you don't do this, getting objects to the correct position on the
                //page is much more difficult.
                document.ViewPreferences.RulerOrigin = idRulerOrigin.idPageOrigin;
    
    
                Page leftPage = masterSpread.Pages.FirstItem();
                Page rightPage = masterSpread.Pages.LastItem();
    
    
                leftPage.MarginPreferences.Top = rightPage.MarginPreferences.Top = 10;
                leftPage.MarginPreferences.Bottom = rightPage.MarginPreferences.Bottom = 10;
                leftPage.MarginPreferences.Left = rightPage.MarginPreferences.Left = 30;
                leftPage.MarginPreferences.Right = rightPage.MarginPreferences.Right = 20;
    
    
                // Create a text frame. Do not add text to this, as this is a master spread text frame.
                // Link their flow together
                TextFrame primaryFirstPageTextFrame = leftPage.TextFrames.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, leftPage);
                TextFrame primarySecondPageTextFrame = rightPage.TextFrames.Add(document.Layers.FirstItem(), idLocationOptions.idUnknown, rightPage);
                primaryFirstPageTextFrame.NextTextFrame = primarySecondPageTextFrame;
                //Set primary text frame of master spread to be the two linked textframes
    
    
                primaryFirstPageTextFrame.GeometricBounds = GetPageBoundsWithMargin(leftPage, document);
                primarySecondPageTextFrame.GeometricBounds = GetPageBoundsWithMargin(rightPage, document);
             
                masterSpread.PrimaryTextFrame = primaryFirstPageTextFrame; //This causes the error
             
                return GetFileData(document, savePath);
            }
    
    

    I noticed the JavaScript API that is very similar to c#, so it would be useful if I get a response from JavaScript.

    Hi Michael,

    Basically, you can do something like this (in ExtendScript):

    //Store value:
    var storedPreset = app.documentPresets[0].createPrimaryTextFrame;
    
    //Let's set it to true:
    app.documentPresets[0].createPrimaryTextFrame = true;
    
    //Add the document, name the master as you wish etc.pp. :
    app.documents.add
    (
    
        {
            documentPrefreneces :
                {
                    facingPages : true
                    ,
                    pageWidth : "210 mm"
                    ,
                    pageHeight : "297 mm"
    
                }
        }
    
    );
    //Reset to stored value:
    app.documentPresets[0].createPrimaryTextFrame = storedPreset;
    

    Uwe

  • How to name a block of text to use textFrames.getByName?

    I think it's a pretty simple question, but I can't find examples explaining how to name the text block, so I can use the getByName feature.

    Right now I'm using a loop for to go through all the text frames and find a corresponding to a text string, but I am afraid that by random chance, that same text string will get used in a graphic and the script will change the incorrect text.

    I found this in an old NET, but couldn't find out how to apply the name to the text box. Extract the data from Excel to Illustrator javascript or vbscript

    Thanks in advance!
    CW

    Figured it out! I can quote the textframe in the layers panel so I show details for the layer that the textframe I want feeds. It defaults to the content of the textframe unless you call it in the layers panel, that's why when I tried to find a name, I wouldn't get a! Once I changed it on the layers panel, I could call him by his name! Sussed this out of one of your previous posts of Carlos, so thank you again for all that you give on these forums!

  • Photoshop CS6. How to jump to a text block to another without going through the toolbar. Is this possible?

    Photoshop CS6. How to jump to a text block to another without going through the toolbar. Is this possible?

    Choose the (circled) T will isolate and stack layers of text to make it from one to the other just about choosing a distinctly named layer

  • I need to select all the blocks of text in a document and align text blocks in the back pages left frame margin and the text in the pages front to the right margin.

    Hello

    Am new to Java script.

    Can someone help me out here, I need to select all the blocks of text in a document and align text blocks in the pages back to the left margin frames and text in pages recto at the right margin.

    Thank you
    Harish

    Hi Harish,

    Try this.

    var doc =app.activeDocument,
        _pages = doc.pages;
    doc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
    for(var i =0;i<_pages.length;i++)
    {
            txfms = _pages[i].textFrames.everyItem().getElements();
            for(var j =0;j
    

    Kind regards

    Cognet

  • How can I get a standard text block can be found on the last page of my documents?

    How can I get a standard text block can be found on the last page of my documents without having to type in all the time? I have a mission statement with a line to the signature of the customer who I want on the last page of my bills and now I have to type every time or cut and paste a previous invoice. I already have a Master Page that contains customer information and my company at the top of each page, and I use the data merge to fill each page with the ordered items and photos etc. I would just have this mandate type block automatically appear on the last page after the last element in the data merge.

    Thank you all in advance for your help.

    Create a new master based on the one you have now and add the block, then change the master applied to the last page.

  • [JS] [CC] how to get the last visible character in a saturated text block?

    Hello

    I am new to InDesign scripting in javascript. I would like to know if there is a way to get the position of the last character in a text frame that is busy? I need this because I want to calculate the number of characters is hidden (overflow text) via the script.

    I looked in the forums about this, but I think it is always a script to alert if there is too much text or not.

    I'd appreciate any help!

    Well, let's say myFrame is a flowing text block.

    Thus, the last character in this context would be

    myFrame.characters-[1];

    To calculate the number of characters to spill, select the

    framework text overflow and run this script:

    myFrame = app.selection [0];

    myParentStory = myFrame.parentStory;

    Alert ("number of characters to spill is

    "+ myParentStory.characters.itemByRange (myFrame.characters [-1],".

    (myParentStory.characters [-1]) .length-1);

    Ariel

  • How to check if the selection is any text tho:

    Ok.. Another question:

    How to check if the selection is any text tho:

        if (app.documents.length != 0 && app.selection.length != 0 &&

         (app.selection[0].constructor.name=="Text"||app.selection[0].constructor.name=="Paragraph"))

    but sometimes the selection is 'textStyleRange', sometimes 'character' etc. is there a shortcut to check both?

    I usually do something like this:

    if ( app.documents.length && app.selection.length && app.selection [ 0 ].hasOwnProperty ( 'baseline' ) )
         alert ( "It's a text!" );
    

    Hope that helps.

    --

    Marijan (tomaxxi)

    http://tomaxxi.com

  • How the auto repeat 'position title (continued)' in the text block

    Hi guys,.

    I've looked everywhere and couldn't find it.

    Here's what I'm trying to achieve:

    I have a few blocks long text which flows into a framework of text block and I would like to have the title for each of the items be repeated first of all in the first line of the block of text on each page as follows (suite).

    I know that I can use master pages and can have a separated with my title text box. But then, if the number of page change, I can end up with a title (continued) where shouldn't.

    The next and previous page number line break does not work for me, because I need it to be the title of the article and it must be in the same frame of definition as title x.

    It's somewhat similar occurs when your table across more than one page. The header is repeated on each image.

    I really tried to find it but no luck. Whenever I have tryied the anwes only I got was to line breaks, next and previous page number.

    Much appreciated if anyone can save me.

    Thank you

    Mau

    I think that we know exactly what you're trying to do, and we told you how to do it in code.

    Word has a few features that allow you to have different headers and footers for section home pages and use them automatically when you set up a new section. This is equivalent to using two masters in ID and one without the variable grant your section start pages. The difference is that you have to do that yourself.

  • Change the margins... How update text blocks to match?

    Hello

    I have a 80-something-odd-page document, I needed to change the margins on. No problem. Now, however, I want to update the 80-something-odd text frames to match the new margins. No, I was not choosing "Master-text block" when I created the document, because I am new to the program and I am usually not smart.

    Is there a way to do this?

    Alternatively, if I now create a new document (with master selected text block), I can "place" the old document in there?

    Thank you very much! Someone out there, you'll earn my cyber-praise with a response.

    There is no need of a block of text type.

    If you all of your blocks of text created by hand, but made sure to exactly match the lil purply indicators 'margins', all you have to do is enable layout adjustment, in the menu available. Then change your margins - you will see that your text frames will follow. (Toot suite too, as say the French!)

Maybe you are looking for

  • Apple Watch Sun, dual image display

    The screen of my watch is on 'bright' (both shows and iPhone settings) but is too weak to be played outdoors. It also has a second image showing under the poster. The second image seems to be the last posting that I opened. I closed, unpaired, like n

  • How to remove synced photos from computer to phone?

    I used to sync my photos to the folder 'Images' from my computer to my phone.  I now want it to stop because there are thousands of photos and they occupy too much space.  I unchecked the box for synchronize photos from my computer to my iPhone, told

  • table without border - gui problem

    Hello I have the array of strings I want to remove the grey spaces between each element (indicated by arrows), but I can't. I want them to be transparent, but I can't Do you have any idea how to do that? Thanks to advice.

  • PIXMA 922 unable to pick up the paper from the lower bin

    I recently bought the PIXMA 922 and have had problems printing.  I put standard Staples copy paper in the lower tray.  When I go to print it sometimes will print a page or two, then it gives me error "Support Code 1008" say that there is no paper.  I

  • Presario CQ56: password unknown administrator or power on password

    I don't know the password to recover my PC. The error code is 91749102 after 3 attempts.