on 06-05-2015 3:43 PM
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
Hi Vincent
What version of Crystal reports are you using? Please be precise.
Also, see KBA 1218161 - Linked OLE objects are not updated when previewed in .NET application
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow me on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you read the KBA Ludek linked to?
Only option is to upgrade to CR 2008 or above. CR Basic for VS did not get this fix.
If you upgrade to VS 2010, 2012, 2013 or 2015 RC you can use the CR runtime from this link:
http://scn.sap.com/docs/DOC-7824
Don
Hi Don,
Sorry i had not seen the link but now i read it. Since VS2010 CR is not joined with VS. If for example i upgrade to VS2010 then i install Support Pack 10 (cr runtime) but i could not modify anymore my reports in VS and i shall have to possess a standalone version of CR, i am right ?
Thank you for your help.
Viincent
Don,
I converted project from VS2008 to VS2010, then i have installed SP 14.
I can open the project with no erros but i don't see any differences with VS2008 version. When i double-clik on my report now is opened with CR 11.5 standalone cr application which is installed on my computer, in VS 2010 code i tried:
-Dim xx As CrystalDecisions.CrystalReports.Engine.Section = reportDocument1.ReportDefinition.Sections("Section3")
-Dim o As CrystalDecisions.CrystalReports.Engine.PictureObject = x.ReportObjects(0)
-'o.???
but i can't found any link property and any OLE object in crystalReport.engine.
Please tell me how to solve that
Thanks in advance
Vincent
You should not need any code(?). By definition an OLE object server will automatically take care of the changes to the object. A test I did:
Create a report with a linked MS Word doc.
Save.
Modify the doc.
Refresh the report - result: OLE Object did not change.
Close and reopen the report - OLE Object change is now visible.
Repeat above in a .NET app - Ole Object changes - if report is closed and reopened in the app.
- Ludek
In Full CR Designer help file here how to:
The SDK will only refresh the OLE Object on Open, it will not refresh it when hitting the refresh button in the viewer last I tested.
But I believe if you dynamically link the object using a formula field based on a database field with the path to the ole object it should refresh.
Don
Hi Ludek,
My ole is linked to a Word document but the document location is different between my computer and that of my customer, when he modify the document how cr can refresh rpt because the link is not the same as mine,i must tell to crystal (at runtime on customer computer) wher the Word document is?!
Am i wrong?
Vincent
Hi,
I did some test and that doesn't work
When i modify Word document report always displays old data, it works as if data was embedded in rpt, i have verified and it's not the case:
I don't understand why it's is not possible to set link and refresh at runtime, why a such limitation, it is a BASIC property of an OLE object, Access does that since the 80's, for a sofware (version14!) specialized in reporting i don't understand!
Or maybe ommited something.
thanks in advance for help.
Vincent
I don't exact code but this is something you need to do:
rptClientDoc.ReportDefController.ReportObjectController.Modify( oPlaceholderPicture, oNewPicture );
// this works and does update the report file with the condition formula.
oNewPicture.Format.EnableCanGrow = false;
rptClientDoc.ReportDefController.ReportObjectController.Modify(oPlaceholderPicture, oNewPicture);
And I kind of recall now for some reason I had to call this API 2 times to get it to work...
Don
See if this sample works for you:
NET-CS2003 RAS-Managed BE115 Add Image | SCN
Basically what you can do is clone the object and make the changes and refresh.
Don
Don,
I'm sorry to disturb you again but i tried your code and it doesn't work for me or maybe i'm missing something :
Then i have downloaded the sample but i think it coded in VS2003, when i launch it VS converter starts but i have errors and code is not converted.
Error is speaking about web site (web application) but i don't understand how this kind of application works.
Vincent
Don, code is in csharp, so there is no vb file, maybe you are speaking about Viewer.aspx.cs, because i can't open the project (conversion error) plus i don't know csharp i have some difficulties to understand the code, i have errors with unknown objects properties when i try in my project. I will try more tomorrow and i'll tell you more.
Vincent
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);
CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;
rptClientDoc = new CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument();
rpt.Load(rptName.ToString(), OpenReportMethod.OpenReportByTempCopy);
rptClientDoc = rpt.ReportClientDocument;
And add all of the RAS assemblies in the References:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportAppServer;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.ReportAppServer.CommonControls;
using CrystalDecisions.ReportAppServer.CommLayer;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ObjectFactory;
using CrystalDecisions.ReportAppServer.Prompting;
using CrystalDecisions.ReportAppServer.DataSetConversion;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.ReportAppServer.XmlSerialize;
Don
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.