1 Reply Latest reply on Jan 18, 2017 9:02 AM by A. Patterson

    Set Character Style

    hong kiemp34358061

      Hi everyone!

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


      Char *CharacterStyleName="Character Style 1";

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


      anyone help me. thanks so much!

        • 1. Re: Set Character Style
          A. Patterson Level 4

          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());
          const ICharFeatures charFeatures = charStyle.GetFeatures();
          const AIArtHandle handle = GetHandle();
          ATE::TextRangeRef textRangeRef = 0;
          error = sAITextFrame->GetATETextRange(handle, &textRangeRef);
          // check error
          ATE::ITextRange textRange(textRangeRef);