本文介绍了rdlc报告转换为jpg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Warning[] warnings;
string[] streamIds;
string mimeType = string.Empty;
string encoding = string.Empty;
string extension = string.Empty;
String deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>JPEG</OutputFormat>" +
" <PageWidth>2.16in</PageWidth>" +
" <PageHeight>3.41in</PageHeight>" +
" <DpiX>300</DpiX>" +
" <DpiY>300</DpiY>" +
" <MarginTop>0in</MarginTop>" +
" <MarginLeft>0in</MarginLeft>" +
" <MarginRight>0in</MarginRight>" +
" <MarginBottom>0in</MarginBottom>" +
"</DeviceInfo>";
LocalReport Report = new LocalReport();
Report.ReportPath = Path.GetFullPath(@"..\..\Report\ReportFront.rdlc");
ReportDataSource QMRDS = new ReportDataSource("ICard_USP_EmployeeMaster_SelectAll", dt);
Report.DataSources.Add(QMRDS);
Byte[] mybytes = Report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIds, out warnings);
using (FileStream fs = new FileStream(Application.StartupPath + @"\Print\" + dt.Rows[0]["Id"].ToString() + "_" + dt.Rows[0]["PId"].ToString() + "_" + "Front.jpg", FileMode.Create))
{
fs.Write(mybytes, 0, mybytes.Length);
fs.Flush();
fs.Dispose();
fs.Close();
}
推荐答案
这篇关于rdlc报告转换为jpg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!