Loading RTF file having Table in TRichEdit without Table borders - delphi

I have a RTF file that I am loading into a TRichEdit control.
Only problem that I am facing is, RTF file has Tables in it, loading the same shows table borders. But when I load the same RTF in MS Word it doesn't show any borders(Client want the same behavior).
Is there any way for not displaying borders of table while loading into TRichEdit.
I am using Delphi7.

TRichEdit control is less complete than MS Word, in its implementation of the RTF format.
As far as I remember, TRichEdit won't handle table borders.
You will need either to embed MS Word as an Active X control, either use a TRichView component. TRichView is the better approach, because TRichEdit behavior is not consistent with diverse version of Windows, and it doesn't depend on an existing MS Word installation. But it's not a free component. :(
If you want only to display some text and tables, you could convert it to HTML, then display it using either an embedded Internet Explorer, either with THtmlView.

If you open the RTF file in older versions of MS Office like 2003 or below, irrespective of specifying no borders, you can still view the borders.
In newer versions of MS Office (2007 and 2010), you cannot view the borders.
As the RTF Engine for TRichEdit is written with older specification, it will show borders in your application.
So you need to have a look on the thrid party components which were specified in #A.Bouchez answer.

Related

How to Use Delphi Translation Editor?

I am using Delphi XE3's Translation Editor.
This is the screenshot:
The GUI is rather confusing as there are many columns I don't know their usages. What I can guess is the white cells are editable and I can input the translated contents, and set the status as "Translated".
I don't know what is the usage of "Previous 中文(简体, 中国)(original)" or "Previous (简体, 中国)(translated)".
The official document is at http://docwiki.embarcadero.com/RADStudio/XE3/en/Editing_Resource_Files_in_the_Translation_Manager. IT does not explain how to use the editor and what is the usage of the columns at all.

VCL RichEdit componet which will load table background

I am using C++ Builder XE2.
I wish to use a RTF file to load a template into a rich edit file so I can change marked strings eg $DATE$.
I have tried both TRichEdit and TJvRichEdit and can do the string replace no problem.
TJvRichEdit also load bmp and JPG which is what I want.
However when I load an RTF file generated in word or wordpad which has cell background colour I get the formatting but not the background colour.
I had a look at the RichView componet (WHich is quite expensive for a single component ($330US).
This loads the background colour but loses the font sizing (Seems to apply its own paragraph style rather than keeping the RTF paragraph file.
Does anyone know of a decent RichText component which will load from rtf file and keep both text formatting as well as the table background and also allow image loading.
Would prefer a free componet or at least reasonable price component < $100 US.

Suggestions for a report designer to produce a 4 quadrant page for printing?

I have a project that needs to produce reports in Delphi XE2 that have 4 elements per page. For instance, one page (11 x 8.5) landscape needs four quadrants
Rich text bulleted items in quadrant one
Bar chart in quadrant two and quadrant three
Pie chart in the final quadrant
Today, these reports are produced with a combination of Excel and Powerpoint which is very time consuming and I'd like to automate the process with a Delphi App.
I've had experience with Report Builder and Rave Reports, but I never ran into a situation where I needed to divide the page up into four areas. It was always the traditional single graph per page design.
Use Fastreport, it has Rich text and Chart objects and can make the layout that you want.
Just put one Rich text object and 3 chart objects on the page and fill them in the code.
You can use fastReport with subReports. Also you can activate the pages columns=2 and I think its possible to do it.
In FastReport you have all you say you need:
Pie Chart
Bar Codes
Ritch ext
And Group & master Detail Lists
One solution is to create you report and export it in pdf or jpeg, and then use another tool to produce the 4 quadrant.
Have a look to (free) PosteRazor application.
http://posterazor.sourceforge.net/
You can use the report generated by code, as available in our mORMot framework.
Each page is rendered in a TMetaFile content. In fact, you can use QuickReport or other report able to export the pages as meta files. The same occurs for charts: you save the chart as EMF content, then you draw it on the TGDIPages report.
Then it is easy to use a 2nd report instance to draw 4 pages per page.
Then you'll have preview, print or native pdf export at hand.

In Delphi, Is there a way to adjust the line spacing of a TMemo?

I'm working with a TMemo component to display some text in a limited space. Currently it's using a truetype font which doesn't ship with windows and is installed by the app when it runs.
On my PC (Running Windows XP), the spacing between each line of text seems to be about eight pixels. On a different PC running Windows 7, the line spacing seems to be about 14 pixels, which is pushing the bottom row of text out of visibility on the memo.
So, My question is really this:
Is this caused by the different versions of Windows? It's all I could think that was different.
Is there some way I can adjust this value so it would be consistent across all instances of the application, wherever it was running?
Alternatatively, is there a different component I could use which might let me tweak this value?
TMemo is a descendent of Windows Common controls and it's behavior depends on current Windows configuration so it is natural to get different results with it.
If you just want to display some information it's better to use components which let you set texts positions and their style precisely like TRichView. This component is not free but it has it's own text rendering engine and let you style texts with CSS like selectors which look the same in different versions of windows.
In addition to Mohsen's answer I'd like to mention LMD ElPack and it's ElEdit component which also has it's own text rendering engine. Unlike TRichView ElEdit is a plain text edit / memo component, so it's a drop-in replacement for TEdit / TMemo. And line height is configurable there

BiDi text in Delphi - How do you select text to edit by language like this pic?

I saw this picture and now wondering if/how you can do this in Delphi. The highlighted/selected text shows two forms of formatting, i.e. highlight color and hash lines.
http://img9.imageshack.us/img9/4121/easilyselecttextofonela.jpg
I've done something very similar recently in a bible application, also done in Delphi.
The user can select a single verse and single words of the selected verses. (But this feature is not released yet, so don't bother looking for it)
I used the web browser control from Microsoft and added my own kind of selection handling.
I've done the formatting by enclosing the relevant parts with span elements and changing their CSS style. When the selection gets removed, I also remove the enclosing elements.
The hard part was backing the "visual" selections with a selection data structure and handling all the selection events (clicking, shift-clicking, shift-ctrl-clicking, ...)
Embedding IE seems to be an easier way to do this as DR says, but you can also do this manually by drawing it all on a canvas, an easy way would be to create two bitmaps (one without a selection and another selected (could be as complicated as you like - dashed, colored, ... )), and you need to know the positions/rects of all your characters which would be somewhat difficult for long texts.
You basically show the unselected bitmap, and overlap the selected parts by portions of the second image.
You would also need to handle the selection manually by OnMouseDown, OnMouseMove, OnMouseUp...

Resources