如何在Access2010中保存RichTextBox内容 [英] How to save RichTextBox content in Access2010

查看:173
本文介绍了如何在Access2010中保存RichTextBox内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个词典系统,其中的单词含义可以在RichTextBox中编辑(用于用户定义FontSize,Color等...)

那么我如何以RTF格式将有意义的RichTextBox内容保存在Access数据库中?而我该如何阅读呢?

解决方案

Access 2007/2010/2013中的本机富文本使用HTML的一部分,而不是RTF,因此除非您希望在以下情况下转换为RTF加载/保存数据后,您将不得不寻找另一种方式来存储格式化的文本.

由于WPF RichText控件使用RTF,所以将数据保存在Access数据库中的最佳方法可能是使用二进制Blob.
在Access中,您可以使用OLE Object数据类型,或者更好的是使用新的如何使用Microsoft Access数据库的附件数据类型? /a>

  • 通过.NET以编程方式管理Microsoft Access Attachment类型的字段
  • 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 RichTextBox content in the Access database in RTF format? And how to can I read this?

    解决方案

    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:

    这篇关于如何在Access2010中保存RichTextBox内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆