Jump to content
Server Maintenance This Week. ×

Convert Styled Text to RTF tagged Text [Finished-7]


This topic is 6761 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Description: This is an example of a calculated field that retrieves the text style of a text field and converts it to rtf tagged text which can be exported to MS word or another rtf compatible application.

Working Under: 7

Solution Status: Finished

Pre-requisites:

Author(s)B) BobWeaver

Date: 11/04/05

Credits:

Instructions / Other Info:

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

rtf.zip

Link to comment
Share on other sites

I'll be most interested in seeing it when it's done.

I've been trying to work with XML/XSL to create RTF and have had some success but am not where I want to be. In Word, I can create a two-column (balanced in length) page, but I haven't figured out the rtf codes to put into my xslt sheet to accomplish that. Neither have I dealt with font issues.

Thanks for the work you have done on this.

James

Link to comment
Share on other sites

Hi Bob and Brudderman,

This is a very useful. I can see creating and storing letters in my custom database and the exporting them to word for printing or additional formatting for instance. However can someone explain how to get it in MS Word (XP). I've exported the example record as a .tab file, and then replaced the .tab extention with .rtf. This file opens up word including the text in the example record but with the with the tags, so I guess I'm completely on the wrong track. Can someone advise how to retain the formatting please?

Cheers

Link to comment
Share on other sites

Jalz,

Is there some special formatting that Word provides that you can't accomplish in FM? If you're just looking to print in Word, as opposed to doing other kinds of things such as creating indexes, etc., then your easiest solution might be to see if you can coax FM into printing the way that you want. That would avoid Word completely.

But should you really need to move the document into Word, there are several ways to get there.

What I'm doing now amounts to mail merge and is pretty simple. First you would need to configure your FM file as an ODBC data source. Then in Word you would create a mail merge template formatted (styles, etc.) as you desire. Then when you merge, Word will connect to the data source (your FM file) and merge in the records which you specify.

This takes a bit of work to set up, but it works quite well.

The tag method which you propose works also, but it's more complicated. Unless someone else suggests a better way, you will need to do some programming in Word VBA to locate the tags and apply the desired style. I posted a code snippet to illustrate this. If you're not at all familiar with Word VBA, the learning curve is a bit steep.

Then you can do the kind of thing that Bob posted for converting certain internal FM styles (underline, etc.) to RTF codes that Word can read. This isn't the same as Word's built in styles if that's what you really require, but Bob's calculation is pretty slick, and I need to look at it further.

Then you can export as XML and transform that with XSL into an rtf document that Word can read.

So here are some options. It might help if you would post a sample of your export with a description of what you want to do.

HTH,

James

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.