We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

OLE Object in word document

Hello, i'm generating Word document using a word template and replacing variables by the text i want.
In this word document i would like to insert other files (pdf,gif..) and be able to see the content directly in the word to print the "order" and all the attachments.

i have try with the code i have found there
http://help.syncfusion.com/ug_81/Reporting_DocIO/defaultasp.html
(The following code example illustrates how to insert an OLE object in disk to a Word document.) but i have only the icone and the objet is not reachable.

thanks for your help or clue





GenererPlainte_c18d2442.zip

5 Replies

AD Administrator Syncfusion Team April 7, 2010 03:26 PM UTC

Hi Alban ,

Thank you for your interest in Syncfusion products.

We were not able to reproduce the mentioned issue .We have prepared a sample for testing , kindly have a look at the sample from the below link ,let us know if it helps. If you still face this problem kindly report through Direct Trac with a sample application to reproduce this issue.

Sample:
http://help.syncfusion.com/support/samples/DocIO.Windows/F93836/OLE-Obj.zip

Please let us know if you have any other questions.

Regards,
Manigandan


AF Alban FAVEROT April 8, 2010 06:26 AM UTC

Thanks for your update.
In my case it's a ASP.Net website.
I have tried with your code by reading the PDf file and i get an icon and the message is "file is corrupt or no longer available(see screen shot)
The path that is write in the Word is the same path that i use to read the stream. (C:\...) this path exist BUT only on the server itself. do i have to use UNC or a share folder ?

// Adding new OLE Object.
string sFileName = ConfigurationManager.AppSettings["PathAttachements"] + pa.Filename;
document.LastParagraph.AppendText(sFileName).CharacterFormat.FontSize = 10f;
document.LastSection.AddParagraph();

// Loads the OlePicture from the file.
WPicture pic = new WPicture(document);
pic.LoadImage(System.Drawing.Image.FromFile(@"C:/Inetpub/wwwroot/Admintool/Pictures/icone_pdf.gif"));
pic.Width = 20f;
pic.Height = 20f;

Stream stream1 = new FileStream(sFileName, FileMode.Open, FileAccess.Read);

// Adding new OLE Object.
document.LastParagraph.AppendOleObject(stream1, pic, OleObjectType.AdobeAcrobatDocument);



Ole_corrupt_f702510.zip


AF Alban FAVEROT April 8, 2010 08:12 AM UTC

[Solved]
I was generating a .doc file , and was using Word 2007 to open it."Compatibilite mode" issue ..
now it works by forcing docx .


AF Alban FAVEROT April 8, 2010 08:25 AM UTC

Is there a way to have the OLE Object converted (content visible)
AND autosized to be printed ?

it's possible in Word , but would like to have it done to avoid tthe users to do it.


AD Administrator Syncfusion Team April 9, 2010 09:19 AM UTC

Hi Alban,

Thank you for your interest in Syncfusion products.

Currently we do not have the support for the content visibility in the OLE object. We logged this as a feature request and forwarded to our development team .Currently we do not have any immediate plan to implement this feature. Sorry for the inconvenience caused.

Please let us know if you have any further queries.

Regards,
Manigandan

Loader.
Live Chat Icon For mobile
Up arrow icon