cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting Dynamic Word File to Crystal Reports From SQL

anilcrystal
Explorer
0 Kudos

Hello. I want to display a dynamic header in my Crystal Report(Visual Studio). These headers are generally created in word documents. Inside it, there is picture and text. I also want to store the file in database. Here what I have tried so far:

1) When I use CR interface and select insert OLE Object, I can select doc file and it gets the content. So I decided directly to convert word file into bits by using FileStream and BinaryReader. Then I stored this bits in SQL DataBase as var . When I drag field object CR it couldn't recognize the file. (It did not worked as I insert OLE object) Probably because in SQL it is stored as varbinary and CR tries to convert it directly to blob object. If there is something wrong with my logic please correct.

2) I tried to screen shot the word document and store the image in database. It works with this way but then it requires effort to adjust the image for user. (Last option)

3) I tried using some 3. party libraries like ImageMagick but this is taking whole page as image. (I need only writen areas)

Is there a way to use word document, which is stored in database, to use in Crystal Reports?

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor

Not one that is stored in the database. I suggest storing it as a file and then storing a UNC path to the file in the database. From there you can add the OLE object to the report and, in its properties, reference the file based on the data.

-Dell

anilcrystal
Explorer
0 Kudos

Thanks for the comment. Actually this option is also discussed. This program is used by many different users. So it is not seems to be the good way of data management since file updates would be problem. Actually I wonder how is everyone deal with this problem I couldn't find it anywhere.

anilcrystal
Explorer
0 Kudos

Somehow UNC path in picture settings for ole object also not working. What might be the reason for this?

DellSC
Active Contributor
0 Kudos

What is happening - how is it "not working"?

-Dell

anilcrystal
Explorer
0 Kudos

Sorry. Let me explain, I thought I might need to open another question.
When I try to set the path for normal picture object it works and when I change path, picture object also changes. But for OLE object, I insert OLE object as empty Word Document. After that I define the path as the same way I did with picture object(settings -> picture -> graphic location). But when I run the program it always shown empty.

There is no problem in word document, because if I import directly (without defining path) from OLE insert option this word document it shows perfect.

I use visual studio 2015 and I installed sp33 for visual studio development. Version is 13.

DellSC
Active Contributor
0 Kudos

Hmmm... I'm surprised it's not working. I'm not sure where to tell you to go from here other than to say you may have to store the headers as images instead, which I know is not your optimum solution.

-Dell

Answers (0)