当前位置: 首页 > news >正文

FastReport 加载Load(Stream) 模板内包含换行符不能展示

 如下代码 当以FastReport  载入streams时 当模板内包含换行符时会导致不能正常生成pdf

System.Xml.XmlDocument newFrxXml= new System.Xml.XmlDocument();
newFrxXml.Load(fileName);FastReport.Report report = new FastReport.Report();using (var memStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(newFrxXml.InnerXml))){report.Load(memStream);}

原因:

通过XmlDocument加载后 换行符由十进制的值变成了16进制展示


=》


导致Fastreport不呢正常加载导致

--正常模板--<Styles><Style Name="EvenRows" Fill.Color="191, 223, 255" Font="宋体, 9pt"/></Styles><Dictionary/><ReportPage Name="PageReport" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" FirstPageSource="15" OtherPagesSource="15" Guides="0,718.2,14.17,51.97,61.42,146.47,155.92,193.72,203.17,231.52,240.97,278.77,288.22,326.02,524.47,581.17,590.62,704.02,222.07,335.47,401.62,515.02,411.07,14.18,99.23,269.33,23.63,108.68,184.28,354.37,363.83,439.43,448.88,524.48,533.93,609.53,618.98,694.58,307.12,382.72,373.27,458.32,477.23,515.03,571.73,637.88,647.33,704.03,529.2,604.8,595.35,708.75" Watermark.Font="宋体, 60pt"><ColumnHeaderBand Name="ColumnHeader" Width="793.8" Height="75.22" CanGrow="true" PrintOn="FirstPage"><ChildBand Name="Child1" Top="78.42" Width="793.8" Height="434.7"><TextObject Name="Text54" Left="137.03" Top="9.45" Width="396.9" Height="311.47" Text="xxx:&#13;&#10;xxx" Format="Date" Format.Format="" VertAlign="Center" Font="宋体, 10pt"/></ChildBand></ColumnHeaderBand><PageFooterBand Name="PageFooter" Top="516.32" Width="793.8" Height="47.63" Fill.Color="White" Guides="37.8,56.7,75.6,47.25,94.5,9.45,28.35,9.45"/></ReportPage>--通过XmlDocument加载后模板--
<Styles><Style Name="EvenRows" Fill.Color="191, 223, 255" Font="宋体, 9pt"/></Styles><Dictionary/><ReportPage Name="PageReport" LeftMargin="0" TopMargin="0" RightMargin="0" BottomMargin="0" FirstPageSource="15" OtherPagesSource="15" Guides="0,718.2,14.17,51.97,61.42,146.47,155.92,193.72,203.17,231.52,240.97,278.77,288.22,326.02,524.47,581.17,590.62,704.02,222.07,335.47,401.62,515.02,411.07,14.18,99.23,269.33,23.63,108.68,184.28,354.37,363.83,439.43,448.88,524.48,533.93,609.53,618.98,694.58,307.12,382.72,373.27,458.32,477.23,515.03,571.73,637.88,647.33,704.03,529.2,604.8,595.35,708.75" Watermark.Font="宋体, 60pt"><ColumnHeaderBand Name="ColumnHeader" Width="793.8" Height="75.22" CanGrow="true" PrintOn="FirstPage"><ChildBand Name="Child1" Top="78.42" Width="793.8" Height="434.7"><TextObject Name="Text54" Left="137.03" Top="9.45" Width="396.9" Height="311.47" Text="xxx:&#xD;&#xA;xxx" Format="Date" Format.Format="" VertAlign="Center" Font="宋体, 10pt"/></ChildBand></ColumnHeaderBand><PageFooterBand Name="PageFooter" Top="516.32" Width="793.8" Height="47.63" Fill.Color="White" Guides="37.8,56.7,75.6,47.25,94.5,9.45,28.35,9.45"/></ReportPage>

解决办法:

 using (var memStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(newFrxXml.InnerXml.Replace("&#xD;", "&#13;").Replace("&#xA;", "&#10;")))){report.Load(memStream);}

http://www.lryc.cn/news/533290.html

相关文章:

  • Maven 中常用的 scope 类型及其解析
  • vue3:点击子组件进行父子通信
  • Composo:企业级AI应用的质量守门员
  • Jackson扁平化处理对象
  • Java即时编译器(JIT)的原理及在美团的实践经验
  • 使用 Ollama 在 Windows 环境部署 DeepSeek 大模型实战指南
  • 算法基础之八大排序
  • 使用TensorFlow和Keras构建卷积神经网络:图像分类实战指南
  • 音频进阶学习十一——离散傅里叶级数DFS
  • 20.<Spring图书管理系统①(登录+添加图书)>
  • 关于图像锐化的一份介绍
  • Django开发入门 – 0.Django基本介绍
  • 多智能体协作架构模式:驱动传统公司向AI智能公司转型
  • CentOS服务器部署Docker+Jenkins持续集成环境
  • 【prompt实战】AI +OCR技术结合ChatGPT能力项目实践(BOL提单识别提取专家)
  • 【Android】Android开发应用如何开启任务栏消息通知
  • 上传文件报错:the request was rejected because no multipart boundary was found
  • 大模型—Dify本地化部署实战
  • 功能架构元模型
  • 常用工具类——Collections集合框架
  • e2studio开发RA2E1(9)----定时器GPT配置输入捕获
  • 25/2/7 <机器人基础>雅可比矩阵计算 雅可比伪逆
  • 网络爬虫js逆向之异步栈跟栈案例
  • 使用Ollama本地部署deepseek
  • Rust错误处理:从灭火器到核按钮的生存指南
  • Golang:Go 1.23 版本新特性介绍
  • 电脑运行黑屏是什么原因?原因及解决方法
  • redis之AOF持久化过程
  • Elasticsearch:向量搜索的快速介绍
  • Docker在安装时遇到的问题(第一部分)