How to save RichTextBox content in Access2010

前端 未结 2 906
青春惊慌失措
青春惊慌失措 2021-01-23 13:57

I\'m creating a dictionary system, where words meaning is editable in RichTextBox (for user define FontSize, Color, etc...)

So how to can I save meaning

相关标签:
2条回答
  • 2021-01-23 14:44

    Native Rich text in Access 2007/2010/2013 uses a subset of HTML, not RTF, so unless you want to convert to/from RTF<>HTML when you load/save your data, you will have to find another way to store your formatted text.

    Since the WPF RichText control uses RTF, the best way to save data in an Access database would probably be to use a binary blob.
    In Access, you can do this either by using the OLE Object data type or, better, the new Attachment data type.

    If you want to be able to do a text search on the text entered through the RichText control, you should probably add another Memo field to your database containing the cleaned-up, pure-text version of the data.

    To work with attachments from .Net, here are a couple related questions:

    • How to use Microsoft Access Database's Attachment Data Type?
    • Programmatically managing Microsoft Access Attachment-typed field with .NET
    0 讨论(0)
  • 2021-01-23 14:44

    You can just use the "Memo" field type if you're in Access 2007 or newer. Setting the TextFormat property to RichText will allow for RTF.

    To edit it, just use a text box with the appropriate field set as its control source.

    To read it via code, access the .Value property. You can also insert formatting tags (e.g. ) this way if you'd like.

    0 讨论(0)
提交回复
热议问题