Page 1 of 1

How to import the checkboxes from a Word or RTF document?

Posted: Tue Nov 08, 2022 2:24 am
by stevef
Using:
+ TDBRichViewEdit v14.2.7
+ Delphi 10.2.3 Tokyo


I have a RTF document that has text and checkboxes in it. However, when I import the document into a RichViewEdit, the text imports correctly but the checkboxes are lost.

This is the code:

Code: Select all

  DBRichViewEdit1.Clear;
  DBRichViewEdit1.LoadRTF(ExtractFilePath(ParamStr(0)) + 'Doc1.rtf');
  DBRichViewEdit1.Format;
  DBRichViewEdit1.DoChange(True);
How can I also import the checkboxes?

My aim is to allow the user to check/un-check a checkbox and also save this to database (hence using TDBRichViewEdit).

Preview of the RTF document is below:
screen capture
screen capture
2022-11-08_04-23-38.png (13.88 KiB) Viewed 4325 times
Thanks in advance!

Re: How to import the checkboxes from a Word or RTF document?

Posted: Tue Nov 08, 2022 7:12 pm
by Sergey Tkachenko
Sorry, loading and saving checkboxes (and other controls) in RTF and DocX is not supported yet, even in the newest version of TRichVew.
Please note that MS Word has two types of checkboxes (and other controls) in document: modern (for DocX only) and legacy for DocX and RTF) controls.
I just checked how they are saved in RTF and DocX. Well, after some work, it is possible to implement reading them to TRichView and saving them back (in future, I plan to implement a special checkbox item type for TRichView, but now they can be represented by a TCheckBox).

However:
- even if I implement it, they will be added in the new version of TRichView; it is not possible to do it in version 14.
- it is not in my plans for near future; so, if you need it fast, it can be implemented on a paid basis (as a sponsored feature).