我有一份报告,我需要多次运行并另存为PDF.我目前正在以编程方式生成PDF报告,但希望保存报告,而无需用户每次手动选择保存选项.
我用来将单个报告呈现为PDF的代码是:
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim deviceInfo As String
Dim bytes As Byte()
Dim lr As New Microsoft.Reporting.WebForms.LocalReport
deviceInfo = "<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"
bytes = ReportViewer1.LocalReport.Render("PDF", deviceInfo, mimeType, encoding, extension, streamids, warnings)
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.BinaryWrite(bytes)
Response.Flush()
Response.Close()
Run Code Online (Sandbox Code Playgroud)
我想我可以循环运行它并且每次都保存PDF.
如果更改下拉列表中的选定项目,我正在尝试更改表格单元格的背景颜色.我使用相同的JavaScript文本框,它工作正常.在firebug中,当从select中调用时,"cell"是未定义的.
这是我的脚本/ html
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
function changeText(cell, shown, hidden)
{
if (shown == hidden)
{
cell.style.backgroundColor="red";
}
else
{
cell.style.backgroundColor="green";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<table cellpadding="5">
<tr>
<td>
Cell 1
</td>
<td>
<select id="catBlah" OnChange="changeText(this.parentnode, this.options[this.selectedIndex].value, '789');">
<option value=""></option>
<option selected="selected" value="789">Item 1</option>
<option value="000">Item 2</option>
<option value="456">Item 3</option>
<option value="123">Item 4</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="text" value="blue" onchange="changeText(this.parentNode, this.value, 'blue');" />
</td>
<td>
Cell 4
</td> …Run Code Online (Sandbox Code Playgroud)