Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

export to word format 1

Status
Not open for further replies.

kap1

Programmer
Nov 23, 2004
11
US
I'm using CR9, VB6 and Access.

When I export a CR9 report to Word the Word document defaults to View-->Print Layout. If I change to View-->Normal, most of the text is all left justified and a mess.
If I leave it as Print Layout all of the text has "boxes or frames" around each.

I need to provide the capability to export a CR9 report from my VB6 application to Word so the customer can then edit the text and do what they want with it.

I would have thought this would be a common need but haven't found much posted on this problem.
Thanks, Kim
 
You might consider trying exporting to RTF, however if you're building objects in Crystal that have borders, than one would logically expect that you wanted borders in the export.

I have on occasion built 2 reports, one for viewing and one for export.

Also make sure that you apply the latest service pack:


-k
 
I get the same results when exporting to RTF. Earlier today I installed service pack 4 for CR9 after reading another post that was similar. Unfortunately, neither one fixed my problem.

I do not have any borders or lines in my reports. When I referred to "boxes or frames" around the text I mean in the view-->print layout if I click on text a border appears around it and it is like a picture that I can drag the object around. Not just plain text.

Actually, I get the same result when exporting any of the sample reports that come with Crystal Reports. This makes me think that this is how all CR9 reports export.

Do your exported reports open up with View-->Print Layout chosen vs. Normal? Then if you choose View-->Normal does the text all shift to the left?
Kim
 
Yes, when I export it the Print Layout is defaulted and that's the only way it looks reasonable (in frames).

However nothing prevents me from editing the output in that mode.

Exporting rarely works how one expects, especially since most differ on what shouold happen.

If you want just text, then perhaps you should export to text. Since many exports involve boders and shading, I think that they elected to always use frames, but again I don't see how this should matter, you can edit what's in the frames.

-k
 
Kim,

The boxes you refer to are called "frames" in MS Word.

You can edit the text in them by clicking on the text in them to set the cursor focus, then typing away to your heart's content.

The frames keep the various components of the report relative to one another while you edit the contents of a frame.

If you export to a pure text format, you can open that document in word. The frames will be gone (and so will fonts, bolding, etc.). And, of course, once they start editing the text for a given item and make it longer, it will cause all the other items to get out of synch with one another.

Here's an example of what I mean. A simple report, with code, title and text description. The code is no more than 5 characters long, the description can be up to 100 characters, and the title can be up to 50 characters long.
Both the title and description field are one row high by default, but can grow to more lines as needed. The underlines show where text would be if both title and description are at maximum length.
Code:
code_ title_______x____________ description__________
      _________________________ _____________________
                                _____________________
                                _____________________
Let's say your user wants to start editing at point x, and adds four characters: a, b, c and d. This is what would happen without the frames:
Code:
code_ title_______xabcd____________ description__________
      _________________________ _____________________
                                _____________________
                                _____________________
Note how the first line of the description got moved out of whack? Here's what might also happen if margins cause a wrap at the end of the line:

Code:
code_ title_______xabcd____________ description______
____
      _________________________ _____________________
                                _____________________
                                _____________________
Notice how the last part of the first description line wrapped to the first of the next line?

That's why the frames are there - to prevent this sort of problem. It's a "good thing".

If the nature of your report's data layout wouldn't cause this problem, export to text and pop that into MS Word.

Hope this helps.

David


David Wendelken
 
Thank you for the detailed reply. You explained it very well.

My problem with exporting to text is that some of the data is chopped off. For example:

Code:
[u].rpt looks like this in design[/u]
Wage, bonus, tip        {totalwages}    {yWages]    

[u]CR preview looks like this[/u]
Wage, bonus, tip            $1230.00   $14760.00

[u]The .txt output[/u]
Wage, bonus, t              $1230.00   $14760.00

[u]Word document[/u]
Wage, bonus, tip            $1230.00   $14760.00

In the word document each piece of text is in a separate frame. So editing is not easy. In the above example, "Wage, bonus, tip" is in one frame, $1230.00 is in another frame and $14760.00 in another frame. If the user wants to add text after the $1230.00, they need to expand the frame and hassle with formatting (the number value is right justified). This isn't very user friendly.

Kim
 
I'm going to make a guess here.

When I opened the txt file I exported from CR, it opened with the font as Courier New, which is a non-proportional font.

I'm guessing that the font that you have in the report is a proportional font.

If so, it's possible that if you changed your report's font to a non-proportional font, you might have the same problem in the CR preview (if the field isn't set to "can grow".

If that's the case, that would be the root of the problem, as it must be "counting characters" in the export to text.

Let us know if that happens, and small changes (like using the same font or making more room for the field) to your report layout in CR make the problem go away.

David Wendelken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top