Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4075476
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:18:10+00:00 2026-05-20T17:18:10+00:00

I have RTF text which I am showing to the user on Mac. Now

  • 0

I have RTF text which I am showing to the user on Mac. Now I need to replace some text. The text has some images inline. When I execute the following code, the images are getting lost. I am using c#, Mono and Monobjc to run this on mac.

NSText _questionView;

// some initialisation code which I have skipped
//
NSRange range = NSRange.NSMakeRange(0, _questionView.TextStorage.Length);
NSData oldString = _questionView.RTFFromRange(range);
if (oldString != null)
{
   string s = oldString.ConvertRTFToString();
   _questionView.ReplaceCharactersInRangeWithRTF(range, s.ConvertToNSData());
   _questionView.SelectedRange = NSRange.NSMakeRange(0,0); 
   // After this line the inline images are lost.
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:18:11+00:00Added an answer on May 20, 2026 at 5:18 pm

    You are losing the images because you are converting the RTF content to NSString. NSString can only carry text, not attributes. You should consider using NSAttributedString instead for the text manipulation, in order to keep the RTF attributes (style, images, etc.).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have some code which produces an RTF document from a RTF template. It
I'm trying Perl on Mac. I have to read an RTF text file. the
I have an existing application that has some parts of formatted text-blocks (standard formats
I have this RTF text: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\colortbl ;\red0\green0\blue0;\red255\green0\blue0;} \viewkind4\uc1\pard\qc\cf1\fs16 test \b bold \cf2\b0\i
I have a RichTextBox that I wish to fill with RTF text at design
All,In my requirement need to send a mail with attached text file, which is
We have rtf text stored in our database that looks like the following: {\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0
I have notes document with rich text field. In this RTF there is attachment
I have a database table with a field containing RTF (Rich text Format). I
I have a simple vb6 editor type application which has a richtextbox as the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.