【发布时间】:2015-07-10 19:23:35
【问题描述】:
好的,我的网站使用 RDLC 生成了数千个 PDF,但我的问题是有时我想通过电子邮件发送它们,但我不想将 PDF 附加到电子邮件中。所以我需要一种生成报告的方法,然后将其转换为文本或 html,以便我可以将其作为电子邮件正文发送。
我也在使用 reportviewr 版本 11
我还尝试将其导出为 .doc,然后尝试将其转换为文本,我尝试将其导出为 excel 文档,然后尝试将其转换,但均无效。
Dim warn() As Warning = Nothing
Dim streamids() As String = Nothing
Dim mimeType As String = String.Empty
Dim encoding As String = String.Empty
Dim extension As String = String.Empty
Dim bytes() As Byte
bytes = rv.LocalReport.Render("MHTML", Nothing, mimeType, encoding, extension, streamids, warn)
'Only one copy of the notice is needed
'If Not Directory.Exists(strFilePath) Then Directory.CreateDirectory(strFilePath)
Dim fs As New FileStream(strFilePath, FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
fs.Close()
这是我正在使用的代码,但它给了我一个错误:Specified argument was out of the range of valid values. Parameter name: format
我也知道这段代码有效,因为我使用完全相同的东西将 rdlc 导出为 PDF
【问题讨论】:
-
为什么不使用作为标准选项的 MHTML 输出?
-
查看我的编辑。添加了我正在使用的代码和我得到的错误。是不是我做错了什么?
-
抱歉——我认为本地报告 (RDLC) 肯定会支持与服务器报告 (RDL) 相同的输出格式。遗憾的是,本地报告似乎仅支持以下格式:Excel、PDF、Word 和 Image.
-
我想通了谢谢!
-
您应该考虑发布您的解决方案作为您自己问题的答案。欢迎使用 Stack Overflow。