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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with insertable objects (rtf, Word) and the char spacing

Status
Not open for further replies.

CP60

Programmer
Oct 16, 2008
145
DE

I have had this problems for several years now, and even reported it once in the Crystal Reports forum (no replies) because I thought it was a CR problem.

I use the OLE container in our application so that the user can create/select several documents (using WordPad, MS Word, Open Office, or whatever)and then these documents are stored as binary in a db table (I'll call it here "Documents"). The user can then link a db stored document to a record in a different table (I'll call it here "Customers")

(The documents usually have text, logo images and different fonts and sizes)

When a report is printed for a record from the Customers table, a blob object (insertable object) on the Crystal Report rpt will dynamically display the correct Document for the selected customer.

There seems to be a problem with the spacing of characters in an ole inserted object.

In MS Office 2007, when I insert a document, all formating always shows correctly. But in the ole container, rtb, and even WordPad on Windows 2007, the character spacing looks often bad.

For example: If I create a Word 2007 document with only the text "Manymanymany" (Font Calibri 11), save it as docx (or doc, or rtf), and then insert as an object back into Word 2007, it shows correctly, but if I insert as an object it into WordPad, it shows "Man ymanym any" (Those are not chr(32) spaces, but instead, more narrow) or some of the letters are slightly crunched together.

If I create the text new and save to a second file, and the insert this, it may come out as "ManyM anymany"

Most of our customers do not have a big issue with this, but some newer ones really do.

I tried the rtb control from Krool's ActiveX CommonControls replacement (vbForums) but inserting the docx as an Object produces the same problem.

Is this already a known issue?

Any ideas what causes it, or how to correct it, or maybe there is a better way of doing this?


Thank you!
 
I'm afraid that the OLE container control is rather old, and has a number of ... limitations. A frequent inability to maintain the fidelity of the display of a source document is one of those limitations. I am not aware of any fix.
 
What about storing documents in PDF format? Obviously suggesting that you change your application is a big decision but PDF offers a one time conversion that does a very good job of cross platform presentation.
 
>Krool's ActiveX CommonControls replacement

You have to understand that most of the Common Controls replacement efforts (e.g Krools, or the older CCRP) really do no such thing. What they do is replace (and hopefully improve) the OCX libraries used to warp the underlying Microsft components; the components themselves remain untouched.

So, if there is a bug in the underlying component, the 'replacement' control won't in the normal run of things fix that.
 
Thank you for the responses.

(Our customers (small townships) generally use anything between Windows 2007 and upward, but mostly W2007).

Pdf seems not to work (or I am missing something). When a pdf is inserted directly in CR (or for that matter, WordPad 2007), (as opposed to using binary data stored in a db, which porduces the same results), the size shrinks to about 60% of the original. But it needs to be the same original size (sorry, forgot to mention that previously), as is the paper settings in MS Word (Scaling it in CR only increases the background white-space of the inserted pdf).

If the 2007 Doc/Docx is opened in MS Word 97 or 2000 and then saved back, everything is fine (however, saving it in 97-2003 format using Word 2007 doesn't help).

Just for the sake of mentioning it, if the 2007 Word doc is inserted into WordPad 2010, it also shows correctly.
So, assuming MS didn't correct the problem until latest 2010 (I do not know if W2008 works or not, but it doesn't matter).

Just so you know what this is for:
If the customer does not have, or want, to use their own pre-printed paper for their logos, mailing and other information arranged in a certain format, then we allow them to create documents of their choice (as long as it is capable of being an insertable embeded object and the work station can view the document), one for the header first page, header following pages. and one for the footer, or instead, just one for the complete size of the paper. to use these instead.

The user then selects from a vb form the objects which are to embedded in to the specific report sections. (The OLE container on the vb form is only used as a preview of the selections). Then the objects are saved into a database, which are pulled by CR during printing.

All has been working for almost 20 years, and still works, except since Word 2007 the spacing problems.

Can a doc be easily saved/"printed" programically as an image using vb6 or VB.Net?
<EDIT< I see something like this is possible if MS Word is installed Link.
 

Was going to suggest we require customers to have only one workstation with MS Word if the they want to make roll their own, and then using our program just create the bmp on that machine and save the binary, and for for the few who do not have MS Office 2007+ at all, offer a send-in-return conversion service.

I guess I set the hopes to high...

\Microsoft Office\Office12\MSWORD.OLB (14.09.2011)

produces the same problem.

Oh well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top