Advertisement
Guest User

Untitled

a guest
Aug 9th, 2019
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.05 KB | None | 0 0
  1. public void Main()
  2. {
  3.     byte[] reportDefinition = null;
  4.     System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
  5.     XmlNamespaceManager nsmanager = new XmlNamespaceManager(doc.NameTable);
  6.     System.Xml.XmlElement templateHeader;
  7.     System.Xml.XmlElement templateFooter;
  8.     System.Xml.XmlElement reportHeader;
  9.     System.Xml.XmlElement reportFooter;
  10.     nsmanager.AddNamespace("rd", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition");
  11.     CatalogItem[] items = rs.ListChildren("/", true);
  12.  
  13.     // find template file
  14.     foreach (CatalogItem item in items)
  15.     {
  16.         if (item.TypeName == "Report" & item.Name == "Custom")
  17.         {
  18.             ;/* Cannot convert EmptyStatementSyntax, CONVERSION ERROR: Conversion for EmptyStatement not implemented, please report this issue in '' at character 621
  19.    at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.DefaultVisit(SyntaxNode node)
  20.    at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.VisitEmptyStatement(EmptyStatementSyntax node)
  21.    at Microsoft.CodeAnalysis.VisualBasic.Syntax.EmptyStatementSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
  22.    at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
  23.    at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.ConvertWithTrivia(SyntaxNode node)
  24.    at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node)
  25.  
  26. Input:
  27. **reportDefinition = rs.GetItemDefinition(item.Path)
  28.  
  29.  */
  30.             MemoryStream stream = new MemoryStream(reportDefinition);
  31.             doc.Load(stream);/* TODO ERROR: Skipped SkippedTokensTrivia *//* TODO ERROR: Skipped SkippedTokensTrivia */
  32.             break;
  33.         }
  34.     }
  35.  
  36.     // load template header / footer into var
  37.     templateFooter = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageFooter", nsmanager);
  38.     templateHeader = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageHeader", nsmanager);
  39.  
  40.     // iterate through catalog items and replace report headers with template
  41.     foreach (CatalogItem item in items)
  42.     {
  43.         if (item.TypeName == "Report" & item.Name != "Custom")
  44.         {
  45.             ;/* Cannot convert EmptyStatementSyntax, CONVERSION ERROR: Conversion for EmptyStatement not implemented, please report this issue in '' at character 1214
  46.    at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.DefaultVisit(SyntaxNode node)
  47.    at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.VisitEmptyStatement(EmptyStatementSyntax node)
  48.    at Microsoft.CodeAnalysis.VisualBasic.Syntax.EmptyStatementSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
  49.    at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
  50.    at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.ConvertWithTrivia(SyntaxNode node)
  51.    at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node)
  52.  
  53. Input:
  54. **reportDefinition = rs.GetItemDefinition(item.Path)
  55.  
  56.  */
  57.             MemoryStream stream = new MemoryStream(reportDefinition);
  58.             MemoryStream outstream = new MemoryStream();/* TODO ERROR: Skipped SkippedTokensTrivia *//* TODO ERROR: Skipped SkippedTokensTrivia */
  59.             doc.Load(stream);
  60.             reportHeader = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageHeader", nsmanager);
  61.             reportFooter = doc.SelectSingleNode("/rd:Report/rd:ReportSections/rd:ReportSection/rd:Page/rd:PageFooter", nsmanager);
  62.             reportHeader.InnerXml = templateHeader.InnerXml;
  63.             reportFooter.InnerXml = templateFooter.InnerXml;
  64.             doc.Save(outstream);
  65.             reportDefinition = outstream.ToArray();
  66.             rs.SetItemDefinition(item.Path, reportDefinition, null/* TODO Change to default(_) if this is not a reference type */);
  67.             stream.Dispose();
  68.             outstream.Dispose();
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement