important!
a another solution to export ai files in wpf solutions.
(using the CS2-3 Com type library).
NB: need to fix bug. replace, with . in the xaml generated file.
I'm sorry you feel frustrated with the text api and documentation.
As you know a text range is a range of characters from a start offset to an end offset, so you can get the text range of a single character, a word, a text run, a glyph run, a paragraph, a text frame, a story or all the stories in the document by iterating the correct container - e.g an IWordsIterator, ITextRunsIterator, ITextLinesIterator, IGlyphRunsIterator, IParagraphsIterator, ITextFramesIterator, IStory, IStories. An ITextRange can contain anything from a single character in a text frame to the entire contents of the document throught the IStories set.
An ITextRun is a range of text with the same features, so if you had a text frame containing 2 lines of text and you changed a single feature attribute, like the font of one of those lines, you would then have 2 text runs - one run would contain the text with the original font, the other would contain the text with the new font.
The following code i took from your original sample and created a new code snippet, which runs in the new SnippetRunner plug-in which will be released in an updated version of the SDK in the next few days. Also in the new SDK is a document called Using the Adobe Text Engine which provides recipes for creating, editing, deleting and styling text.
# /* / ASErr SnpTest::Do(void)
{
ASErr result = kNoErr;
try {
AIArtSet artSet = NULL;
result = sAIArtSet->NewArtSet(&artSet);
aisdk::check_ai_error(result);
AIArtSpec specs[1] = {{kTextFrameArt,0,0}};
result = sAIArtSet->MatchingArtSet(specs, 1, artSet);
aisdk::check_ai_error(result);
AIArtHandle textArtHandle = NULL;
result = sAIArtSet->IndexArtSet(artSet, 0, &textArtHandle);
aisdk::check_ai_error(result);
ATE::TextRangeRef textRange = NULL;
char* thisWord = "test ";
result = sAITextFrame->GetATETextRange(textArtHandle, &textRange);
aisdk::check_ai_error(result);
ATE::ITextRange firstRange(textRange);
firstRange.InsertAfter(thisWord);
ATE::ITextRange newRange = firstRange.C
important!
i wish code was open source, but it's not the case. but excellent job. - Toto RoToto on 2008-03-27