• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Set Character Style

New Here ,
Jan 18, 2017 Jan 18, 2017

Copy link to clipboard

Copied

Hi everyone!

i'm setting style to character, but it doesn't change.

code:

Char *CharacterStyleName="Character Style 1";

const ASUnicode *charStyleName=ai::UnicodeString(CharacterStyleName,kAIPlatformCharacterEncoding).as_ASUnicode().c_str();

oChar.SetNamedCharStyle(charStyleName);

anyone help me. thanks so much!

TOPICS
SDK

Views

323

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Jan 18, 2017 Jan 18, 2017

Copy link to clipboard

Copied

LATEST

I don't know if I've ever gone that method. We do something more like this:

ATE::DocumentTextResourcesRef textResourcesRef = 0

auto error = sDocument->GetDocumentTextResources(&textResourcesRef);

// check error

IDocumentTextResources textResources(textResourcesRef);

const auto charStyle = textResources.GetCharStyle(localStyleName.au_str());

assert(!charStyle.IsNull());

const ICharFeatures charFeatures = charStyle.GetFeatures();

const AIArtHandle handle = GetHandle();

ATE::TextRangeRef textRangeRef = 0;

error = sAITextFrame->GetATETextRange(handle, &textRangeRef);

// check error

ATE::ITextRange textRange(textRangeRef);

textRange.ReplaceOrAddLocalCharFeatures(charFeatures);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines