 |
|
|
 |
|
 |
Hi Alex, Thanks for your aritcle. its working for me. i have added the another resource file in with Japanese font and it working fine. I want to export this Japanese font report to PDF. But when i export report to PDF it will be shown as ????. Do you have any idea whether we can export to Localise report to PDF. is it a Report desinger error or PDF error. Please help. --Sam
|
|
|
|
 |
|
 |
Sorry, I have never tried to do it.
|
|
|
|
 |
|
 |
Thanks for reply. i have done it. we have to set the font(in my case i set msgothic) in report designer in reports controls and that font should be insalled in the server. Thanks again. --Sam
|
|
|
|
 |
|
 |
Where and what am i missing?
this code produces some error:
DataSet ds = services.getOrdersReport(1, "", DateTime.Parse(System.DateTime.Now.Date.ToShortDateString()));
ReportDataSource datasource = new ReportDataSource("JMJ", ds.Tables[0]);
rv.LocalReport.DataSources.Clear();
rv.LocalReport.DataSources.Add(datasource);
rv.LocalReport.Refresh();
ERROR :
A data source instance has not been supplied for the data source 'dsOrders_tblOrdersReport'
'dsOrders_tblOrdersReport' -- name of the table designed in dataset.XSD
|
|
|
|
 |
|
 |
What about chart control? it doesnt have LocID for Legend.
tks
Rodrigo
|
|
|
|
 |
|
 |
Good solution for WinForm application, thanx !
|
|
|
|
 |
|
 |
Move strings from code to resx and translate their automatically. Try RGreatEx[^] free.
---
Best regards,
Alexander Nesterenko
Safe Develop Team
www.safedevelop.com
|
|
|
|
 |
|
 |
Hello, do you help me ? I Have a problem.
I have a subreport in my localreport. But in the method LocalizeReport, after the command report.LoadReportDefinition
i'm call the method LoadSubreportDefinition however my subreport isn't globalized.
Each subreport have your resource.
I need globalization eache subreport of mey report contains.
thanks
|
|
|
|
 |
|
 |
The following is what I'm using. I'm very new at coding for xml, so it was a struggle working out how to navigate. So I'm sure someone will know how better to search for the node.
I also wasn't able to work out what to do if a sub report had its own subreports (if that's possible).
private void ProcessReport(LocalReport report)
{
// I use an event to process the xml as I might want to
// change the processing depending on the report
// and this is a generic report processor.
if (OnProcessXmlEvent != null)
{
string nameSpace = GetNamespace(report.ReportEmbeddedResource);
const string rdlc = ".rdlc";
string reportName = report.ReportEmbeddedResource;
XmlNamespaceManager manager;
XmlDocument document = GetDocument(out manager, reportName);
if (document.DocumentElement != null)
{
// Call event to process xml
OnProcessXmlEvent(reportName, document, manager);
report.ReportEmbeddedResource = string.Empty;
using (StringReader outputStream = new StringReader(document.DocumentElement.OuterXml))
{
report.LoadReportDefinition(outputStream);
}
// Read in each subreport name
foreach (XmlNode node in
document.DocumentElement.SelectNodes("/nm:Report/nm:Body/nm:ReportItems/nm:Subreport/nm:ReportName", manager))
{
// Process each subreport
string fullPath = nameSpace + node.InnerText + rdlc;
XmlNamespaceManager subReportManager;
XmlDocument subReportDocument = GetDocument(out subReportManager, fullPath);
if (subReportDocument.DocumentElement != null)
{
// Callback to process whatever's needed in the subreport
OnProcessXmlEvent(fullPath, subReportDocument, subReportManager);
using (StringReader outputStream = new StringReader(subReportDocument.DocumentElement.OuterXml))
{
report.LoadSubreportDefinition(node.InnerText, outputStream);
}
}
}
} //if (document.DocumentElement != null)
}
}// function
// Returns an XLM document for the report
private XmlDocument GetDocument(out XmlNamespaceManager manager, string reportName)
{
XmlDocument result = new XmlDocument();
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(reportName))
{
if (stream != null)
{
result.Load(stream);
manager = new XmlNamespaceManager(result.NameTable);
manager.AddNamespace("nm", "http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition");
manager.AddNamespace("rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner");
return result;
}
throw new Exception("Stream = null");
}
}// function
// The following is example event handler I use to process one of my reports
private static void OnProcessXml(string reportName, XmlDocument document, XmlNamespaceManager manager)
{
if (reportName.ToUpper() == C_REPORT_DAILY_SUBREPORT.ToUpper())
{
if (document.DocumentElement != null)
{
// Make legend invisible in this report
foreach (XmlNode node in document.DocumentElement.SelectNodes(
"/nm:Report/nm:Body/nm:ReportItems/nm:List/nm:ReportItems/nm:Chart/nm:Legend/nm:Visible", manager))
{
node.InnerText = C_FALSE.ToLower();
}
// do localization as in original author's article
LocaliseDocument(document);
}
}
}// function
|
|
|
|
 |
|
 |
It works. Thank you.
I can confirm that my rdlc reports are 100% working with:
- external images
- internal images loaded from files as gatalogue articles images
- localization
- subreports (thank you for the tip)
- subreports containing subreports: just load definition files for report, subreports, sub-sub reports and so on
Andrea
|
|
|
|
 |
|
 |
Hello when the web is precompiled the function fails, does not find the file with extension .rcp
Ideas? Thank you
|
|
|
|
 |
|
 |
I precomilied the web and didn't get any rcp file. What version of Visual Studio do you use?
|
|
|
|
 |
|
 |
Visual Studio 2005, Framework 2.0
|
|
|
|
 |
|
 |
Thanks,
I’ve made some changes in the code – I moved report’s resource files under App_LocalResources folder. Please try new version.
|
|
|
|
 |
|
 |
I believe that it is not a problem of the code, the problem this one in the precompiled
If Precompiled your example, it continues failing. It works if I copy the original file .rcp to the capeta App_Data
|
|
|
|
 |
|
 |
Would you please send me your precompiled example?
|
|
|
|
 |
|
 |
Hello, i tried to use the source code, but i had an execution exception at this line :
String localizedValue = (string)HttpContext.GetLocalResourceObject(virtReportPath, node.Attributes["rd:LocID"].Value);
"La classe de la ressource correspondant à cette page est introuvable. Vérifiez si le fichier de ressources existe et réessayez".
// System.InvalidOperationException:
// The resource class for the page was not found.
I tried in vain to resolve it so please i need your help.
Thank u.
|
|
|
|
 |
|
 |
Did you create a resource file for the report?
|
|
|
|
 |
|
 |
I’ve made some changes in the code – I moved report’s resource files under App_LocalResources folder. Please try new version.
|
|
|
|
 |
|
 |
By modifying a couple of lines I've managed to use the same idea in windows applications in a ReportViewer:
- Load the report xml by doing something like this
Stream str = Assembly.GetExecutingAssembly().GetManifestResourceStream( report.ReportEmbeddedResource);
doc.Load(str);
str.Close();
- get your localized strings by ResourcesFile.ResourceManager.GetString(...
- and I don't know why but loading the report from a StringReader didn't work for me, so I did this:
File.WriteAllText(tempFile, doc.DocumentElement.OuterXml);
reportViewer1.LocalReport.ReportPath = tempFile;
and after Refreshing the reportviewer deleting the temporary file
Any idea why loading from the StringReader didn't work ?
Andrea Sabbatini
Sviluppo software - Software development
www.andreasabbatini.com
www.doctorsoffice.it
|
|
|
|
 |
|
 |
I tried your modification. In my case the StringReader didn't work because the Report's ReportEmbeddesResource had the name of the report.
Changing the line:
lr.ReportPath = String.Empty
to:
lr.ReportEmbeddedResource = String.Empty
worked for me.
Is this your case?
|
|
|
|
 |
|
 |
[EDIT][AGAIN] (sorry)
I've just found out that:
1) your method works like a charm. Thanks a lot !
2) for some reason ALL the ValueLocID, LabelLocID, etc have been lost by the project. This dodgy behaviour of visual studio has been going on for some time. Besides every time I open the project and immediately shut it down, it asks to save 'modifications' (what ?)
Ciao
Andy
Andrea Sabbatini
Sviluppo software - Software development
www.andreasabbatini.com
www.doctorsoffice.it
modified on Friday, November 14, 2008 2:43 PM
|
|
|
|
 |
|
|
 |
|
 |
Hi,
I would like to the same think with reporting services.
When user is connecting on the portail web. I don't want to create a web application on dot.net.
Have you go a solution for me.
Thank.
Nadège BAUBANT (French)
|
|
|
|
 |