Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Refresh ole link at runtime ?

Hello,

I have a report in my VS2008 application, in this report i have a linked Word document (aciveX ole object). The word document is modified out of the program. That is working on my computer but at runtime on the customer network when they modify the Word Document, rpt is not updated when they run my application.

How to set/change the link path of the ole object at runtime and refresh report ?

Thanks in advance.

Vincent

Former Member
replied

Basically you can get the object properties and thne delete the ole object and then add it back in.

That should give you the recent file:

rpt.Load("D:\\CPP Net\\RASXIR2Printer\\oleobject.rpt");
rptClientDoc = rpt.ReportClientDocument;

String MyfilePath = "C:\\temp\\mansheart.jpg";

//Determine which section to add the picture field to - in this case the report footer section
boSection = rptClientDoc.ReportDefController.ReportDefinition.PageFooterArea.Sections[0];

boPictureObject.Left = 1010;
boPictureObject.Width = 500;
boPictureObject.Height = 200;
boPictureObject.Top = 100;
boPictureObject.OriginalWidth = 50;
boPictureObject.OriginalHeight = 30;
boPictureObject.Name = "dontest";

//Add it to the report
boPictureObject = rptClientDoc.ReportDefController.ReportObjectController.ImportPicture(MyfilePath, boSection, 1, 1);

rpt.SaveAs("c:\\temp\\savedimage.rpt", true);
MessageBox.Show("c:\\temp\\savedimage.rpt", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question