×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    58

    Removing a CRichText from a file.

    I can write a CRichText to a file, and later read it, but I seem to be unable to delete it completely from the file:

    iStore is a CFileStore* opened on a file
    iRichText is a CRichText*

    I can store the richtext to the file with:
    TStreamId streamId = iRichText->StoreL(*iStore);

    I can read the richtext from the file with:
    iRichText->RestoreL(*iStore,streamId);

    I have tried this to remove the richtext from the file:
    iStore->DeleteL(streamId );

    But it seems that richtext formatting information is still present in the file after the DeleteL, as I can see from the size of this file and if I look at it with a text editor (e.g. remaining names of fonts), even after a CompactL() operation. What is missing here?

    Thanks,

  2. #2
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    155

    Re: Removing a CRichText from a file.

    search in the documentation etc. for compacting of stores.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    58

    Re: Removing a CRichText from a file.

    Thank you for the quick answer. As said, I actually do a regular compact on this store. This is done with RStoreReclaim::CompactLC(), running smoothly within an active object. I can check that the text of my deleted CRichText is removed after that, but the formatting information is still there. There must be something more needed to cleanup a richtext... What?

  4. #4
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    155

    Re: Removing a CRichText from a file.

    Sorry didn't notice about the compact in your posting.
    Perhaps a CRichText object externalizes itself to more than one stream, I can imagine that its formating data and actual text data get stored to separate streams.
    Last edited by Mr. Buttington; 2008-02-20 at 22:24.

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    58

    Re: Removing a CRichText from a file.

    Quote Originally Posted by Mr. Buttington View Post
    Perhaps a CRichText object externalizes itself to more than one stream, I can imagine that its formating data and actual text data get stored to separate streams.
    That's probably what happens, but iRichText->StoreL(*iStore) only produces ONE
    streamId. Note also that the fully formatted richtext is restored from that single streamId with iRichText->RestoreL(*iStore,streamId). How can I guess what the other streamId(s) can be?

  6. #6
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    155

    Re: Removing a CRichText from a file.

    I'm not speaking from authority but maybe what you are doing isn't a valid operation given how CRichTexts are stored - if you want to delete everything you delete the entire store. Incidentally the SDK confirms that more than one stream is used.

    If you can't do this because you want to store more than one rich text object in the store you can create a separate stream for each rich text object then create an embedded store withing that stream and then pass that embedded store to the StoreL() function.

    Alternatively look at if you can achieve what you want without using StoreL(), i.e. look at using StoreComponents() and other methods for example.

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    58

    Re: Removing a CRichText from a file.

    You are right: I have a potentially large number of rich text objects, and I create one stream for each. I will look at creating one embedded store for each rich text, as you suggest. I assume that deleting the embedded store will remove all elements of the deleted rich text object, not just the text part as presently.

    Thanks a lot for your help.

  8. #8
    Regular Contributor
    Join Date
    Jan 2007
    Posts
    155

    Re: Removing a CRichText from a file.

    Deleting an embedded store should remove everything inside it.


    However I don't know if you can create a stream once and then create and delete stores within it repetedly, but I suspect that you can't - in which case you will have to delete the stream (and as the embedded store is within the stream you are therefore also deleting it).

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    58

    Re: Removing a CRichText from a file.

    Agreed. Presently I delete the stream AAA and create a new one each time the richtext object is modified. Now I will do the same except that the richtext object will be in one stream aaa in one store SSS embedded in stream AAA. If there are side streams bbb ccc for components and style for the same richtext in SSS, these side streams will all be deleted when AAA is deleted.

    Now I only need to learn what an embedded store is ;-)

    [Edited] The suggested solution worked perfectly. My files are now clean. The SDK documentation on embedded stores is very clear and helpful.

    Thanks again.
    Last edited by kylom; 2008-02-22 at 15:36.

Similar Threads

  1. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Symbian
    Replies: 35
    Last Post: 2008-01-17, 09:12
  2. Contacts fields order??
    By timatima in forum Symbian
    Replies: 1
    Last Post: 2007-06-08, 13:51
  3. Creating and installing SIS file...
    By Himanshu_Joshi in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2007-04-12, 17:36
  4. How to create mbm file?
    By qt_raip in forum Symbian Tools & SDKs
    Replies: 13
    Last Post: 2004-05-12, 11:07
  5. Replies: 0
    Last Post: 2002-11-19, 08:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×