Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Main()
- {
- byte[] reportDefinition = null;
- System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
- XmlNamespaceManager nsmanager = new XmlNamespaceManager(doc.NameTable);
- System.Xml.XmlElement templateHeader;
- System.Xml.XmlElement templateFooter;
- System.Xml.XmlElement reportHeader;
- System.Xml.XmlElement reportFooter;
- nsmanager.AddNamespace("rd", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition");
- CatalogItem[] items = rs.ListChildren("/", true);
- // find template file
- foreach (CatalogItem item in items)
- {
- if (item.TypeName == "Report" & item.Name == "Custom")
- {
- ;/* Cannot convert EmptyStatementSyntax, CONVERSION ERROR: Conversion for EmptyStatement not implemented, please report this issue in '' at character 621
- at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.DefaultVisit(SyntaxNode node)
- at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.VisitEmptyStatement(EmptyStatementSyntax node)
- at Microsoft.CodeAnalysis.VisualBasic.Syntax.EmptyStatementSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
- at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
- at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.ConvertWithTrivia(SyntaxNode node)
- at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node)
- Input:
- **reportDefinition = rs.GetItemDefinition(item.Path)
- */
- MemoryStream stream = new MemoryStream(reportDefinition);
- doc.Load(stream);/* TODO ERROR: Skipped SkippedTokensTrivia *//* TODO ERROR: Skipped SkippedTokensTrivia */
- break;
- }
- }
- // load template header / footer into var
- templateFooter = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageFooter", nsmanager);
- templateHeader = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageHeader", nsmanager);
- // iterate through catalog items and replace report headers with template
- foreach (CatalogItem item in items)
- {
- if (item.TypeName == "Report" & item.Name != "Custom")
- {
- ;/* Cannot convert EmptyStatementSyntax, CONVERSION ERROR: Conversion for EmptyStatement not implemented, please report this issue in '' at character 1214
- at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.DefaultVisit(SyntaxNode node)
- at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.VisitEmptyStatement(EmptyStatementSyntax node)
- at Microsoft.CodeAnalysis.VisualBasic.Syntax.EmptyStatementSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
- at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
- at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.ConvertWithTrivia(SyntaxNode node)
- at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node)
- Input:
- **reportDefinition = rs.GetItemDefinition(item.Path)
- */
- MemoryStream stream = new MemoryStream(reportDefinition);
- MemoryStream outstream = new MemoryStream();/* TODO ERROR: Skipped SkippedTokensTrivia *//* TODO ERROR: Skipped SkippedTokensTrivia */
- doc.Load(stream);
- reportHeader = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageHeader", nsmanager);
- reportFooter = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageFooter", nsmanager);
- reportHeader.InnerXml = templateHeader.InnerXml;
- reportFooter.InnerXml = templateFooter.InnerXml;
- doc.Save(outstream);
- reportDefinition = outstream.ToArray();
- rs.SetItemDefinition(item.Path, reportDefinition, null/* TODO Change to default(_) if this is not a reference type */);
- stream.Dispose();
- outstream.Dispose();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement