Hello,
I'm trying to set my CrystalReportViewer to 100% of page width in ASP.NET. When I set the Width property on the control in the ASPX page itself, the viewer renders itself correctly when the page first loads, but on each postback the "%" is changed to "px" causing the viewer to be only 100 pixels wide.
I can apparently get around that by setting the width to Unit.Percentage(100) on every Page_Load event. Then the viewer appears as I expect with 100% width everytime I navigate pages, search, or export.
My problem is this workaround doesn't seem to work for the group tree. When I toggle the group tree, the two divs that get rendered are of width 14px and 86px (which add up to 100px).
Any ideas how I can get around this bug?
Thanks,
JamesI have a lousy solution but it seems to work (this is C# code but same should apply to VB):
public class MyCrystalReportViewer : CrystalDecisions.Web.CrystalReportViewer
{
protected override void Render(HtmlTextWriter output)
{
string renderedControl = string.Empty;
// Render the control to a string builder
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter htw = new HtmlTextWriter(sw);
base.Render(htw);
// Extract the string for processing
renderedControl = sb.ToString();
// Replace certain strings in the group tree div style tag
// Be sure to check for all indices along the way and just do nothing if things aren't found.
int groupTreeIndex = renderedControl.IndexOf("<div class=\"crgrptr\"");
if ( groupTreeIndex != -1 )
{
int groupTreeStyle = renderedControl.IndexOf("style=\"",groupTreeIndex);
if ( groupTreeStyle != -1 )
{
int groupTreeStyleEnd = renderedControl.IndexOf("\"",groupTreeStyle+7);
if ( groupTreeStyleEnd != -1 )
{
string groupTreeStyleTag = renderedControl.Substring(groupTreeStyle+7,groupTreeStyleEnd-groupTreeStyle-7);
renderedControl = renderedControl.Substring(0,groupTreeStyle+7)
+ "display:inline;" + groupTreeStyleTag.Replace("width:14px","width:14%").Replace("position:absolute","position:static")
+ renderedControl.Substring(groupTreeStyleEnd);
}
}
}
// Replace certain strings in the page div style tag
// Be sure to check for all indices along the way and just do nothing if things aren't found.
int pageIndex = renderedControl.IndexOf("<div class=\"crystalstyle\"");
if ( pageIndex != -1 )
{
int pageStyle = renderedControl.IndexOf("style=\"",pageIndex);
if ( pageStyle != -1 )
{
int pageStyleEnd = renderedControl.IndexOf("\"",pageStyle+7);
if ( pageStyleEnd != -1 )
{
string pageStyleTag = renderedControl.Substring(pageStyle+7,pageStyleEnd-pageStyle-7);
renderedControl = renderedControl.Substring(0,pageStyle+7)
+ "display:inline;" + pageStyleTag.Replace("width:86px","width:86%").Replace("position:absolute","position:static")
+ renderedControl.Substring(pageStyleEnd);
}
}
}
// Now output the reformatted HTML of the control
output.Write(renderedControl);
}
}
Showing posts with label cr10. Show all posts
Showing posts with label cr10. Show all posts
Monday, March 19, 2012
Sunday, March 11, 2012
CR10 RDC Default Printer Issue
Hi All,
I'm glad to have found this forum! I've slogged thru Crystal issues on my own for quite a while now and it's a relief to have a place to go to share information. I have a few questions today, so please bare with me.
I'm converting an ASP application from CR8 to CR10 CE Embedded. For the most part I'm using RAS to display and print reports. I have a couple of reports where the users send the reports directly to the printer without viewing them first.
First question, is there a way of sending a report directly to the printer and not the viewer in RAS? I haven't come across one and it looks like I'll have to use RDC for those reports.
I'm experimenting with RDC in ASP and I'm having an issue with the default printer.
Second question, how do you set the printer using RDC? I'm using the following code:
Set session ("oApp") = Server.CreateObject("CrystalRuntime.Application.10")
Set session("oRpt") = session("oApp").OpenReport(application("RASReportPath") + "XYTDailySchedule_test.rpt")
session("oRpt").SelectPrinter "winspool.drv", "DuplicationLaserJet", "P3_10.1.2.200"
session("oRpt").PrintOut false
The report keeps printing to the default printer, no matter what I'm setting it to programmatically. I thought maybe it had to do with the printer selected in the Report Designer, so I set that to "No Printer", and that didn't help.
I popped the oRpt object into the debug watch window and observed that the SelectPrinter method did not change the properties in oRpt. Hmmmm! Not sure what is going on there.
Third question, is there a good resource somewhere for learning the RDC and RAS object models? I can see the properties in a debug window, but I have not found good documentation on the methods. I have found that Business Objects has not improved the product documentation since they took over. It would really be nice to find a clear, concise reference of the object models.
Thanks!
LindaSecond question, how do you set the printer using RDC? I'm using the following code:
Set session ("oApp") = Server.CreateObject("CrystalRuntime.Application.10")
Set session("oRpt") = session("oApp").OpenReport(application("RASReportPath") + "XYTDailySchedule_test.rpt")
session("oRpt").SelectPrinter "winspool.drv", "DuplicationLaserJet", "P3_10.1.2.200"
session("oRpt").PrintOut false
I was able to figure this out on my own and am posting the solution in case somebody else is in the same boat. I had an error in the DeviceName and Port parameters. SelectPrinter must do validation before applying the parameters supplied. If the parameters are incorrect SelectPrinter does not change the printer settings. Perhaps there is a property in the RDC to trigger an error if this happens.........it certainly would have been useful to me!
I would still like to hear if anyone knows how to send a report directly to the printer using RAS, or if anyone has come across some good documentation of the RAS and RDC API's.
Thanks!
Linda|||First question, is there a way of sending a report directly to the printer and not the viewer in RAS? I haven't come across one and it looks like I'll have to use RDC for those reports.
VICTORY!!!! Just for the record, I was told months ago by Business Objects that this was impossible. I came across a white paper today, on the Business Objects site, that discusses RAS Server-Server Side printing, and gives you the code sample as well. Here it is:
http://www.buisnessobjects.com/global/pdf/dev_zone/ras_serverside_printing.pdf?ref=devzone_netzone_archive
Linda
I'm glad to have found this forum! I've slogged thru Crystal issues on my own for quite a while now and it's a relief to have a place to go to share information. I have a few questions today, so please bare with me.
I'm converting an ASP application from CR8 to CR10 CE Embedded. For the most part I'm using RAS to display and print reports. I have a couple of reports where the users send the reports directly to the printer without viewing them first.
First question, is there a way of sending a report directly to the printer and not the viewer in RAS? I haven't come across one and it looks like I'll have to use RDC for those reports.
I'm experimenting with RDC in ASP and I'm having an issue with the default printer.
Second question, how do you set the printer using RDC? I'm using the following code:
Set session ("oApp") = Server.CreateObject("CrystalRuntime.Application.10")
Set session("oRpt") = session("oApp").OpenReport(application("RASReportPath") + "XYTDailySchedule_test.rpt")
session("oRpt").SelectPrinter "winspool.drv", "DuplicationLaserJet", "P3_10.1.2.200"
session("oRpt").PrintOut false
The report keeps printing to the default printer, no matter what I'm setting it to programmatically. I thought maybe it had to do with the printer selected in the Report Designer, so I set that to "No Printer", and that didn't help.
I popped the oRpt object into the debug watch window and observed that the SelectPrinter method did not change the properties in oRpt. Hmmmm! Not sure what is going on there.
Third question, is there a good resource somewhere for learning the RDC and RAS object models? I can see the properties in a debug window, but I have not found good documentation on the methods. I have found that Business Objects has not improved the product documentation since they took over. It would really be nice to find a clear, concise reference of the object models.
Thanks!
LindaSecond question, how do you set the printer using RDC? I'm using the following code:
Set session ("oApp") = Server.CreateObject("CrystalRuntime.Application.10")
Set session("oRpt") = session("oApp").OpenReport(application("RASReportPath") + "XYTDailySchedule_test.rpt")
session("oRpt").SelectPrinter "winspool.drv", "DuplicationLaserJet", "P3_10.1.2.200"
session("oRpt").PrintOut false
I was able to figure this out on my own and am posting the solution in case somebody else is in the same boat. I had an error in the DeviceName and Port parameters. SelectPrinter must do validation before applying the parameters supplied. If the parameters are incorrect SelectPrinter does not change the printer settings. Perhaps there is a property in the RDC to trigger an error if this happens.........it certainly would have been useful to me!
I would still like to hear if anyone knows how to send a report directly to the printer using RAS, or if anyone has come across some good documentation of the RAS and RDC API's.
Thanks!
Linda|||First question, is there a way of sending a report directly to the printer and not the viewer in RAS? I haven't come across one and it looks like I'll have to use RDC for those reports.
VICTORY!!!! Just for the record, I was told months ago by Business Objects that this was impossible. I came across a white paper today, on the Business Objects site, that discusses RAS Server-Server Side printing, and gives you the code sample as well. Here it is:
http://www.buisnessobjects.com/global/pdf/dev_zone/ras_serverside_printing.pdf?ref=devzone_netzone_archive
Linda
CR10 and vb6
Hi to all,
Im still a newbie in cr10, Im making a report from my database using vb6 as it's front end. I have a question regarding filters in CR10 since in data environment as we know we can do this dte1.rsCmd.Filter or
dte1.rsCmd.Requery
How do i do this in CR10? I have a customized filters ( a series of cbo boxes to filter search in database) in my form..
Any help is welcome guys. I really need help
Thanks in advance!Hi again,
I hope i stated my question clear. Im looking for a way to filter my database by using the vb6 cbo boxes and printing it using crystal report 10.. Im using MySQL as my database. Any ebooks or tuts, suggestions are welcome.|||You can use selection formula
CR.selection formula=Column='Some value'"
or
CR.SQLQuery="YourQuery"
Im still a newbie in cr10, Im making a report from my database using vb6 as it's front end. I have a question regarding filters in CR10 since in data environment as we know we can do this dte1.rsCmd.Filter or
dte1.rsCmd.Requery
How do i do this in CR10? I have a customized filters ( a series of cbo boxes to filter search in database) in my form..
Any help is welcome guys. I really need help
Thanks in advance!Hi again,
I hope i stated my question clear. Im looking for a way to filter my database by using the vb6 cbo boxes and printing it using crystal report 10.. Im using MySQL as my database. Any ebooks or tuts, suggestions are welcome.|||You can use selection formula
CR.selection formula=Column='Some value'"
or
CR.SQLQuery="YourQuery"
CR10 and Lotus Notes
We have a Win2K RAS server (CR10) with IIS. However, our applications run on Lotus Notes, which is another server. Previously, when we were using CR8 we generated a URL line and passed it on to the pageserver. Now, in version 10, we are supposed to write ASP code. My question is twofold:
1-where can I get sample code for calling a report in Lotusscript?
2-what module do I need to install on Lotus Notes server to support the code?
Thank you very much.Try searching on Crystal's Website:
http://support.businessobjects.com/search/advsearch.asp
1-where can I get sample code for calling a report in Lotusscript?
2-what module do I need to install on Lotus Notes server to support the code?
Thank you very much.Try searching on Crystal's Website:
http://support.businessobjects.com/search/advsearch.asp
CR10 ActiveX print orientation
Does anyone know how to set the page orientation of the print dialog on the users machine at runtime? Is it possible?
i.e. if you create a CR with landscape layout and the users default print setup is portrait the report will not print correctly.You need to define something called :
crep.PaperOrientation = 2 ; //crDefaultPaperOrientation
Where
crDefaultPaperOrientation= 0
crLandscape= 2
crPortrait = 1
Goto Crystal reports'd developer help and search for PaperOrientation or CRPaperOrientation :
Printer Settings
This application (some demo application) demonstrates how to change the report printer settings at runtime using code.
There are four new report properties that allow you to easily retrieve and set PaperSize, PaperOrientation, PaperSource, and PrinterDuplex for the report printer options. All of these are demonstrated.
There is also a new method called PrinterSetup that provides a Windows standard printer setup window to allow the user to change the printer properties directly at runtime. This is demonstrated as well.
The two methods are independent of each other. For example, changing the Windows standard printer setup will not alter the report printer settings and vice-versa. These new properties and the new method give you much more control over how the report is printed.
Thanks
:wave:
i.e. if you create a CR with landscape layout and the users default print setup is portrait the report will not print correctly.You need to define something called :
crep.PaperOrientation = 2 ; //crDefaultPaperOrientation
Where
crDefaultPaperOrientation= 0
crLandscape= 2
crPortrait = 1
Goto Crystal reports'd developer help and search for PaperOrientation or CRPaperOrientation :
Printer Settings
This application (some demo application) demonstrates how to change the report printer settings at runtime using code.
There are four new report properties that allow you to easily retrieve and set PaperSize, PaperOrientation, PaperSource, and PrinterDuplex for the report printer options. All of these are demonstrated.
There is also a new method called PrinterSetup that provides a Windows standard printer setup window to allow the user to change the printer properties directly at runtime. This is demonstrated as well.
The two methods are independent of each other. For example, changing the Windows standard printer setup will not alter the report printer settings and vice-versa. These new properties and the new method give you much more control over how the report is printed.
Thanks
:wave:
CR10 & CR11 with lotus Notes R6
Hi all friends
does anyone know where i can download CR10 or CR11 even demo version?
does CR10 & CR11 working with lotus notes??Check out here
http://support.businessobjects.com/
does anyone know where i can download CR10 or CR11 even demo version?
does CR10 & CR11 working with lotus notes??Check out here
http://support.businessobjects.com/
CR 8.5 to CR 10 in Visual C++
Hello,
I have an application in Visual C++ working with CR 8.5. To do it, I'm using crpe.h, cpre32m.lib,... but in CR10 these files don't exist.
In CR 10, the print engine is replaced by RDC.
My question is , can I use RDC without use managed code? All samples on Crystal work with managed code but I can't use in my application !!!!
How can I link my application to the new print engine?
Thanks a lot for your helpDid you ever find the answer to this question?? I have the same issue.|||See if you find solution here
http://support.businessobjects.com/|||how do i refresh crystal report data through codes|||CR.Refresh
where CR is the Crystal Reports component
I have an application in Visual C++ working with CR 8.5. To do it, I'm using crpe.h, cpre32m.lib,... but in CR10 these files don't exist.
In CR 10, the print engine is replaced by RDC.
My question is , can I use RDC without use managed code? All samples on Crystal work with managed code but I can't use in my application !!!!
How can I link my application to the new print engine?
Thanks a lot for your helpDid you ever find the answer to this question?? I have the same issue.|||See if you find solution here
http://support.businessobjects.com/|||how do i refresh crystal report data through codes|||CR.Refresh
where CR is the Crystal Reports component
Subscribe to:
Posts (Atom)