Creating .doc file on Unix Platform

Posted by dhullp on 13-Jun-2009 06:41

Hi,

Is there any way to create a .doc file which has the table and some HTML tags as the data in the table on unix platform.

I have already tried using the some of the following solutions...


PUT UNFORMATTED "<html>" SKIP.
PUT UNFORMATTED "<body>" SKIP.
PUT UNFORMATTED "<table border='1'>" SKIP.
PUT UNFORMATTED "<tr>" SKIP.
PUT UNFORMATTED "<td> Field Name</td>" SKIP.
PUT UNFORMATTED "<td> Value </td>" SKIP.

etc...

But they don;t work for when one of the colum data has following contents

<html>

<body>

   <p>This is am Email template. </p>

</body>

</html>

I would apopreciate any help.

Can this be done using some API etc,

All Replies

Posted by Stefan Drissen on 14-Jun-2009 15:56

You need to differentiate between the tags that you are creating and the content. When putting content into the file you need to ensure that any html charaters are escaped. Generally this means replace:

  • & with &amp;
  • > with &gt;

Posted by dhullp on 15-Jun-2009 13:13

Hi Stefan,

Thansk for your response.

I tried and if the content which I want to output to one of the column of the .doc file from a DB table field are not appearing ok on openning the .doc file.

Following is the value of the DB table field which I am trying to output :

          

This is a sample email temlate

<>,

<>

          

In the abobe example the <>, <> will be the field for merging purpose in the email template.

I would appreciate any help/idea.

Thanks.

Posted by Stefan Drissen on 15-Jun-2009 14:11

What is your output? If you have done this correctly, it should be something like:

field name

value

whatever

&lt;html&gt;
&lt;body&gt;
&lt;p&gt; This is a sample email temlate

&lt;&lt;Date&gt;&gt;,

&lt;&lt;Name&gt;&gt;

&lt;/html&gt;
&lt;/body&gt;

Posted by dhullp on 16-Jun-2009 03:48

Hello Stefan,

Thanks for your response. This worked. I was missing the ';' while replacing the '' with '&lt' and '&gt'.

Is there any way to retain the exact formatting while outputting -

<>

<>,

  This is a sample email that has been generated by the MergeIT Extensions.

If the above is the value of a DB field when output as message gives me the same formatting but when output to a column in word document all the abobe formatting is lost.

Any idea?

Posted by Stefan Drissen on 16-Jun-2009 18:24

What data type is your field? You state that there is adobe formatting in there, how?

If you want to present adobe formatting in html then you will need to find something that translates adobe formatting to html formatting.

What are you trying to accomplish?

Posted by dhullp on 17-Jun-2009 06:49

Field is character data type.

Trying to create a word document which has a table with 2 columns. Once of the colum cell has the value which I sent in last email This column value is coming from a DB table field. I want to populate the value in the column cell as it is, as shown in last example i.e. with lines etc in between.

Posted by Stefan Drissen on 17-Jun-2009 07:25

How do you include adobe formatting in a character field?!?

If you want line breaks simply replace "~n" with the break tag (
) before normalizing your field value.

Posted by dhullp on 17-Jun-2009 13:40

I have found another way, now I am not using the .doc file started using .xml instead.

Thanks for your help Stefan.

This thread is closed