Why is the text in duplicate TextStyleRanges?

I use the COM API of c# InDesign (I don't know if that makes a difference, my guess is that this behavior would be the same with other technologies as well).

I have a story in a document that looks like the following (this is a simplified example, and also, this document was created not by me, but rather given to me by a designer):

"This is the first sentence. It's the second sentence. »

When I did this document with the SDK, I treat each TextStyleRange in all paragraphs of the story. What is the right approach to use to convert the text to a different format?

My problem is that the values of the Paragraph.Contents and the TextStyleRange.Contents are incompatible. I created a little app to test that goes through paragraphs and the textStyleRanges and writes the value of the content property. The result is similar to the following:

Paragraph 1, contents: "this is the first sentence."

1.1 TextStyleRange, contents: "this is the first sentence."

Paragraph 2, content: "" this is the "".

TextStyleRange 2.1, content: 'this '.

2.2 TextStyleRange, content: "the second sentence is."

Paragraph3, content: "second sentence".

3.1 TextStyleRange, content: "second sentence."

So as you can see, the textStyleRanges of the second paragraph contains text that is not in the property contained in the second paragraph. And this piece of text is repeated in the last paragraph. So if I have to go and treat each TextStyleRange, then I find myself with the following text:

"This is the first sentence. It is the second sentence. second sentence. »

If the last two words are duplicated.

I don't know why this duplication is in the data, it does not appear if I open the indd file in InDesign.

Also, if I export the document in IDML, it produces sort of a correct result, something like this:

< history Self = "u917" AppliedTOCStyle = "n" TrackChanges = "false" StoryTitle = "" $ID / "AppliedNamedGrid ="n">"

< ParagraphStyleRange AppliedParagraphStyle = "ParagraphStyle/lead" >

< CharacterStyleRange AppliedCharacterStyle = "CharacterStyle / $ID / [no style character]" >

< content > This is the first sentence. < / content >

< / CharacterStyleRange >

< CharacterStyleRange AppliedCharacterStyle = "CharacterStyle / $ID / [no style character]" >

< content > is the < / content >

< Br / >

< content > second sentence. < / content >

< / CharacterStyleRange >

< / ParagraphStyleRange >

< / history >

What can be the reason for this? How can I programatically understand that I don't have to deal with the last paragraph?

This is due to a unfortunate change in behavior since (thinking) possibly CS2-> CS3. "TextStyleRange" allows to limit the content to a single paragraph, but something has changed and now it * may * extend into the following paragraphs that have the same formatting.

As it also happens in Javascript, it must be intentional and can be integrated. Note that "search text" in the user interface * also * works the same (maybe it was to not do, too long ago).

For Javascript, I can work around it by comparing the index of the latest range of text style with the index of the last character in the paragraph of its parent. This works, because the 'index' indicates a shift in * characters * at the beginning of a story.

If you already work according to paragraph in any case, it may be useful first to collect all the starting index of each paragraph. Then, just to test the latest range of style against that and it down if it exceeds.

... Annoying, isn't?

Tags: InDesign

Similar Questions

  • Why is the text in small fuzzy characters on photoshop?

    Why is the text in small fuzzy characters on photoshop? I am * an ad for a newspaper! and the text is blurry printing and when zoomed in all appear blurry? How can I stop this I only have photoshop and indesign

    the myriad police and the size of the ad is 3.3 "x 5.4" inches! Add looks fine here but then when its print it pixelates

  • Why is the text of different sizes?

    Hello

    The text with this browser shows different sizes of text on a web page? Some is normal, then some is tiny. I you pinch the page upward to read the small text, normal text is very large. It ruins the reading a web page. Why this happens, and can I do about it? It's especially hard when he's on a forum.

    Thank you.

    Hello
    This issue has been resolved, but have a lot of ideas suddenly something to help you

  • Why keep the text jumping

    The drafting of emails, text keeps jumping, so that sections of it are found in other parts of the text. It's not me the wrong key.
    Any advice would be appreciated
    Thank you

    Hello

    Some Thunderbird problems can be solved by make a clean reinstall. This means that you remove the Program Files of Thunderbird then reinstall Thunderbird. Please follow these steps:

    1. Download the latest version of Thunderbird from http://www.mozilla.org/en-US/thunderbird/ and save the file to install it on your computer.
    2. Once the download is complete, close all windows in Thunderbird (click on Exit/Quit the menu button on the right).
      • Windows:

        • C:\Program Files\Mozilla Thunderbird\
        • C:\Program Files (x 86) \Mozilla Thunderbird\
      • Mac: Remove Thunderbird in the Applications folder.
      • Linux: If you installed Thunderbird with the distribution-based package manager, you must use the same way to uninstall: see Install Thunderbird on Linux. If you have downloaded and installed the binary package of the Thunderbird Download Page, simply remove the thunderbird folder in your home directory.
    3. Now, go ahead and reinstall Thunderbird:
      1. Double-click on the downloaded Setup file and go through the steps in the installation wizard.
      2. Once the wizard is completed, click to open Thunderbird after you click the Finish button.

    WARNING: Uninstaller or the use of Thunderbird and not run a third remover as part of this process, because who could permanently delete your Thunderbird data, including but not limited to, extensions, email, personal settings and the saved passwords. These can be recovered, unless they have been backed up on an external device!

    Please report back to see if this helped you!

    Thank you.

  • Why are the texts and logos on the tabs do on new windows of firefox?

    Opening a new window of firefox, the text on the tab (for example Mozilla Firefox Start Page) and the logo to the left of this one first becomes misaligned, almost as if the text has been "cut in half" vertically and not place back together with precision. The button fullscreen and him "open a new tab" button overlap too on the upper right side.

    To access the full mode screen, cmd + ctrl + F must be pressed twice. Once to get back to 'normal' browser how the tabs should look like, with the text of the tab and the normal logo, and the second time it gets full screen.

    What happens whenever a new window opens. Only happens once per window.

    I have attached a link to an image via photobucket here, so you can see what it looks like at- http://i1282.photobucket.com/albums/a533/RGomes11/ScreenShot2013-05-14at215321_zps5b08b7ed.png

    Thanks for your help!

    You can try to delete the file plist in Firefox (org.mozilla.firefox.plist).

    Go to "~/Library/Preferences" and delete the plist for Firefox (org.mozilla.firefox.plist)

    You can also check the problems caused by a corrupt localstore.rdf file.

  • Why is the text I add tilted by default?

    I use: Adobe Illustrator 2015.2.1 Release on OSX (yosemite).

    When I press T, then start typing the text is inclined to about 30-40degrees. See the screenshot: https://dl.dropboxusercontent.com/u/35370420/test_text_ai.png.

    How do I change it back to be horizontal by default, so each time I start typing the text it is placed horizontally? Under Type-> Type horizontal Orientation is selected.

    I know that I can turn the box, but it's a pain to have to run whenever I type text.

    In Illustrator on windows 7 (64-bit), the same version, the text is placed as planned, horizontally.

    Thank you

    In preferences, set the Angle of force it to zero.

  • Why is the text in my master page header reformatted after the publication of Business Catalyst?

    Everything goes well with the text in my master page header in Muse, but when you are viewing my site online, the text is reformatted and a biased. I contacted tech support, and they told me that there is a problem with Business Catalyst, they are working on right now. The workaround is to open your site in Muse, click 'File', choose 'Properties of the Site' and under "Advanced", uncheck «Enable in the browser Edition.» Once you publish the site again, the problem should disappear. I'm curious to hear if anyone else has had this problem and if this workaround is successful or if you know other solutions.

    Hi Rebecca,.

    If you are publishing to Business Catalyst, go to file > properties of the Site in Muse. The 'Advanced' Panel will turn off IBE. We will address this problem in an update very soon.

    Kind regards

    _Ankush

  • Why is the text in a document sent to me unreadable except...?

    The lines of text in the document appear in light blue, but the color disappears and the text is readable when I click on a line, but I can only read one line at a time.

    Light blue higligets the fields in the form. When a person completes a field using Mac preview, the apparitions of field gets corrupted. When you click the field contents become temporarily readable. It's fixable by using a script in Acrobat, not reader.

  • Help! Why all the text in my changes just went missing?

    From one day to the next my file suddenly doesn't seem to include all the changes I made in PDF - in the case of destruction (in blue) with a substitution (although I saved all changes are all missing in the relevant boxes). Help!

    Hi - 2015 version, Version 007.20033

    I made comments and they were not lost. But two other things happened, and I think that know why. (1) for anywhere, I deleted and added text, the deletion was upheld, but the addition was empty. (2) anywhere, I added text was lost.

    I went for a while to preview because it has a search function of different or better, and the document from an extract of registration causes these specific types of losses.

    A severe headache!

  • Why was the text increase keyboard + mouse shortcut combination deleted?

    To easily increase page text size in the previous version of Firefox, I used to be able to press control + option + swipe two fingers upwards or downwards (trackpad equivalent to scroll upwards or downwards). This feature seems to have been deleted in FF 17.0.1. Is it possible please re-added?

    You can restore the zoom feature by changing the related values of downtown on the topic: config page.

    • Browser.Gesture.Pinch.in -> cmd_fullZoomReduce
    • Browser.Gesture.Pinch.in.Shift-> cmd_fullZoomReset
    • Browser.Gesture.Pinch.out-> cmd_fullZoomEnlarge
    • Browser.Gesture.Pinch.out.Shift-> cmd_fullZoomReset
    • Browser.Gesture.Pinch.Latched-> false

    The default values for this action, then you may consider to change to use the above, posted orders.

    • Browser.Gesture.Swipe.Down-> cmd_scrollBottom
    • Browser.Gesture.Swipe.up-> cmd_scrollTop
  • FLASH CS4 - tabs of the text object?

    Just learn Flash CS4 and I cannot believe you cannot create or put the tabs in a text object. You can set tabs for editing actionscript, but not in a text object. Are you kidding me? Same wordpad can do that. Please tell me that there are a few keystrokes hidden or something. Why is the text-formatting so hard when you can put things in 3D... I'm puzzled.

    fix.

    or, use a dynamic textfield, set tabs using actionscript and assign the text with actionscript.

  • Why 12 items to hang as soon as I open the text tool?  Get the message "an unexpected and unrecoverable problem has occurred.  Photoshop Elements will now stop.  With the help of Mac

    Why 12 items to hang as soon as I open the text tool?  Get the message "an unexpected and unrecoverable problem has occurred.  Photoshop Elements will now stop. "In Mac Help.  No imported fonts

    First check your fonts folders and make sure none of them are empty. Then get out the font book (applications > utilities) and check all your fonts, with which and resolve duplicates and fix any problems.

  • When the caps lock is on, why there is nothing to notify me in the text area?

    In Google Chrome, when the "caps lock" is on, there is an icon will be in the text area to tell you that "caps lock" turned on, why this feature good practice is not in Firefox?

    Forgive me if there is no error

    Hello

    If you want to leave a comment for the developers of Firefox, you can go to the Firefox help menu and select submit comments... or use this link. (You will need to be on the latest version of Firefox to submit comments). Your comments gets collected at http://input.mozilla.org/, where a team of people read it and collect data on the most common questions.

    Accountable if that helps! Thank you!

  • When I receive an SMS, the digital indicator does not appear on the text message icon. Why?

    Once I receive an SMS, it should be a digital display on the icon of the SMS application that displays the number of messages unread I received. This is not the case. So I am unable to see that I have received a message, I don't have the text application open. No idea why this is?

    Check the settings-> Notifications and see if the badge icon is enabled for this app.

  • Why the texts to someone iCloud email sent in a green box in iMessage?

    On my old iPhone 5, I sent iMessages to someone iCloud email address and my text boxes were blue, as they are on an iPhone. I try to send a message to that same email on my current iPhone iCloud 6 and the text box was green. This person still has an iPhone then why are they sent green as an 'SMS', but it is still going to be another iPhone?

    Have you tried toggling of iMessage power on the phone?

    Also, see some of the suggestions in this thread: iMessage on my Mac sends more messages. It only sends text Messages, even to contacts who have apple ID

Maybe you are looking for