Windows 10 Active Reports 6 PdfExport.Export()方法在Windows 10创建者更新后抛出ArgumentOutOfRangeException 问题

Windows 10 Active Reports 6 PdfExport.Export()方法在Windows 10创建者更新后抛出ArgumentOutOfRangeException 问题,windows-10,activereports,Windows 10,Activereports,我有一些代码使用活动报表6的PdfExport类生成PDF报表。我正在Windows 10计算机上运行此代码。创建者更新后,代码开始抛出ArgumentOutOfRangeException 该代码在Windows Server上运行时运行良好,只是在我的Windows 10计算机上没有运行 此外,我还尝试切换到XlsExport类,报告运行良好 代码 错误详细信息 ArgumentOutOfRangeException 消息 Index was out of range. Must be no

我有一些代码使用活动报表6的
PdfExport
类生成PDF报表。我正在Windows 10计算机上运行此代码。创建者更新后,代码开始抛出
ArgumentOutOfRangeException

该代码在Windows Server上运行时运行良好,只是在我的Windows 10计算机上没有运行

此外,我还尝试切换到
XlsExport
类,报告运行良好

代码 错误详细信息 ArgumentOutOfRangeException

消息

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at #mqc.#Vqc.#RZc(Int32 fontIndex, String fontName, FontStyle fontStyle, Single sizeInPoints, Boolean vertical)
   at DataDynamics.ActiveReports.Export.Pdf.PdfExport.#7pk(Document document, Stream stream, String pageRange)
   at DataDynamics.ActiveReports.Export.Pdf.PdfExport.Export(Document document, Stream stream, String pageRange)
   at DataDynamics.ActiveReports.Export.Pdf.PdfExport.Export(Document document, Stream stream)
...
Stacktrace

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at #mqc.#Vqc.#RZc(Int32 fontIndex, String fontName, FontStyle fontStyle, Single sizeInPoints, Boolean vertical)
   at DataDynamics.ActiveReports.Export.Pdf.PdfExport.#7pk(Document document, Stream stream, String pageRange)
   at DataDynamics.ActiveReports.Export.Pdf.PdfExport.Export(Document document, Stream stream, String pageRange)
   at DataDynamics.ActiveReports.Export.Pdf.PdfExport.Export(Document document, Stream stream)
...
经过阅读和一些尝试和错误,我发现了一个修复方法

解决方案 打开报表设计器文件代码隐藏。在我的例子中,它位于文件
SomeReport.rpx.vb

找到设计器生成的代码区域:

#Region "ActiveReports Designer generated code"
    Public WithEvents Detail1 As DataDynamics.ActiveReports.Detail
    Friend WithEvents ReportHeader1 As DataDynamics.ActiveReports.ReportHeader
    Friend WithEvents ReportFooter1 As DataDynamics.ActiveReports.ReportFooter
    ....
1.样式声明需要
字体系列
在该代码区域内,查找
Style
properties的实例:

Me.Label2.Style=“font-family:Arial;颜色:黑色;字体大小:10pt;字体重量:粗体;文本对齐:右侧;ddo字符集:1”

您需要确保每个
样式
属性都包含
字体系列
。检查您的代码并修复丢失的任何代码

2.样式表声明还需要
字体系列
还要查找这样的代码实例,并确保它们还定义了
字体系列

Me.StyleSheet.Add(New DDCssLib.StyleSheetRule("font-family: Times New Roman; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 16pt; font-size-adjust: inherit; font-stretch: inherit", "Heading1"))
3.注意
font-family:inherit
您需要明确定义
字体系列
,如果在设计的代码中看到
字体系列:继承
,请将其替换为字体名称

结论 一旦添加了所有缺少的
字体系列
,您的报告就可以正常工作了