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

ops/2025/2/12 1:42:12/

 如下代码 当以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.ppmy.cn/ops/157663.html

相关文章

String bean配置-基础笔记

前言&#xff1a;在哔哩哔哩上找的黑马课程做的笔记&#xff0c;课程地址是Spring-06-bean基础配置_哔哩哔哩_bilibili bean基础配置 bean别名配置&#xff1a; bean的作用范围&#xff1a; spring给我们创建的对象默认的是单例的&#xff0c;在bean里面配置scope,可创建多个…

Lisp语言的字符串处理

Lisp语言的字符串处理 Lisp&#xff08;LISt Processing&#xff09;是一种历史悠久的编程语言&#xff0c;因其独特的表现形式和强大的符号处理能力而受到广泛关注。在Lisp中&#xff0c;字符串处理是一个重要的领域&#xff0c;涉及到许多操作和技巧。本篇文章将深入探讨Lis…

DeepSeek元学习(Meta-Learning)基础与实践

元学习(Meta-Learning),也称为“学会学习”(Learning to Learn),是一种让模型快速适应新任务的技术。与传统机器学习不同,元学习的目标是通过少量数据或少量训练步骤,使模型能够在新任务上快速学习并表现良好。DeepSeek提供了强大的工具和API,帮助我们高效地构建和训练…

Linux Windows macOS如何安装Ollama

安装Ollama 安装Ollama的步骤相对简单&#xff0c;以下是基本的安装指南&#xff1a; 访问官方网站&#xff1a;打开浏览器&#xff0c;访问Ollama的官方网站。 下载安装包&#xff1a;根据你的操作系统&#xff0c;选择相应的安装包进行下载。 运行安装程序&#xff1a;下载完…

使用Python和`moviepy`库从输入的图片、动图和音频生成幻灯片式视频的示例代码

下面是一个使用Python和moviepy库从输入的图片、动图和音频生成幻灯片式视频的示例代码。在这个示例中&#xff0c;我们将依次展示每张图片或动图&#xff0c;同时播放音频。 from moviepy.editor import ImageClip, VideoFileClip, AudioFileClip, concatenate_videoclipsdef…

Baumer工业相机堡盟相机的相机传感器芯片清洁指南

Baumer工业相机堡盟相机的相机传感器芯片清洁指南 Baumer工业相机1.Baumer工业相机传感器芯片清洁工具和清洁剂2.Baumer工业相机传感器芯片清洁步骤2.1、准备步骤2.2、清洁过程1.定位清洁工具2.清洁传感器3&#xff0e;使用吹风装置 Baumer工业相机传感器芯片清洁的优势设计与结…

我用AI做数据分析之数据清洗

我用AI做数据分析之数据清洗 AI与数据分析的融合效果怎样&#xff1f; 这里描述自己在使用AI进行数据分析&#xff08;数据清洗&#xff09;过程中的几个小故事&#xff1a; 1. 变量名的翻译 有一个项目是某医生自己收集的数据&#xff0c;变量名使用的是中文&#xff0c;分…

DeepSeek开源多模态大模型Janus-Pro部署

DeepSeek多模态大模型部署 请自行根据电脑配置选择合适环境配置安装conda以及gitJanus 项目以及依赖安装运行cpu运行gpu运行 进入ui界面 请自行根据电脑配置选择合适 本人家用电脑为1060&#xff0c;因此部署的7B模型。配置高的可以考虑更大参数的模型。 环境配置 安装conda…