因此我們注意到在升級到IE11
後,ReportViewer(Version=10.0.0.0
)中的打印按鈕消失了。
這是怎麼看起來像IE10
:
做了一些研究之後,我們發現,其他人還報告這個問題(即here),但是沒有找到解決的辦法呢。
使用compability模式將是一種解決方法選項,但不適合客戶使用。
有沒有人找出如何解決這個問題?在使用IE11的ReportViewer中不能使用打印按鈕
4
A
回答
4
這幾個星期,我們面臨同樣的問題。 最後,我們找到了一些辦法來解決它,下面是步驟:
- 更新「報告查看器2012運行系統」,以11.1.3366
- 更新「Microsoft .NET框架」 4.5.1
- 重啓系統
我們的環境: 贏Server 2008 R2中, IIS7, 的ReportViewer 11
1
我有使用d代碼(http://msdn.microsoft.com/en-us/library/ms252091.aspx),併爲此創建了一個類。你可以添加一個按鈕到頁面並調用它。
---- Call ---------
ReportPrinter prnt = new ReportPrinter();
prnt.Print(rpt.LocalReport);
Class Code
------------
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
namespace javaFish.blogspot.Utils
{
/// <summary>
/// Prints report as xps file to default printer.
/// </summary>
public class ReportPrinter : IDisposable
{
//Local variables
private int m_currentPageIndex;
private IList<Stream> m_streams;
private LocalReport report = null;
/// <summary>
/// Routine to provide to the report renderer, in order to save an image for each page of the report.
/// </summary>
/// <param name="name"></param>
/// <param name="fileNameExtension"></param>
/// <param name="encoding"></param>
/// <param name="mimeType"></param>
/// <param name="willSeek"></param>
/// <returns></returns>
private Stream CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek)
{
Stream stream = new MemoryStream();
m_streams.Add(stream);
return stream;
}
/// <summary>
/// Export the given report as an EMF (Enhanced Metafile) file.
/// </summary>
/// <param name="report"></param>
private void Export()
{
string deviceInfo =
@"<DeviceInfo>
<OutputFormat>EMF</OutputFormat>
<PageWidth>"+ report.GetDefaultPageSettings().PaperSize.Width.ToString()+ @"in</PageWidth>
<PageHeight>" + report.GetDefaultPageSettings().PaperSize.Height.ToString() + @"in</PageHeight>
<MarginTop>" + report.GetDefaultPageSettings().Margins.Top.ToString() + @"in</MarginTop>
<MarginLeft>" + report.GetDefaultPageSettings().Margins.Left.ToString() + @"in</MarginLeft>
<MarginRight>" + report.GetDefaultPageSettings().Margins.Right.ToString() + @"in</MarginRight>
<MarginBottom>" + report.GetDefaultPageSettings().Margins.Bottom.ToString() + @"in</MarginBottom>
</DeviceInfo>";
Warning[] warnings;
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream,
out warnings);
foreach (Stream stream in m_streams)
stream.Position = 0;
}
/// <summary>
/// Handler for PrintPageEvents
/// </summary>
/// <param name="sender"></param>
/// <param name="ev"></param>
private void PrintPage(object sender, PrintPageEventArgs ev)
{
Metafile pageImage = new
Metafile(m_streams[m_currentPageIndex]);
// Adjust rectangular area with printer margins.
Rectangle adjustedRect = new Rectangle(
ev.PageBounds.Left - (int)ev.PageSettings.HardMarginX,
ev.PageBounds.Top - (int)ev.PageSettings.HardMarginY,
ev.PageBounds.Width,
ev.PageBounds.Height);
// Draw a white background for the report
ev.Graphics.FillRectangle(Brushes.White, adjustedRect);
// Draw the report content
ev.Graphics.DrawImage(pageImage, adjustedRect);
// Prepare for the next page. Make sure we haven't hit the end.
m_currentPageIndex++;
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
}
/// <summary>
/// Exports local report and tries to print
/// </summary>
public bool Print(LocalReport localReport)
{
try
{
report = localReport;
Export();
if (m_streams == null || m_streams.Count == 0)
throw new Exception("Error: no stream to print.");
PrintDocument printDoc = new PrintDocument();
if (!printDoc.PrinterSettings.IsValid)
{
throw new Exception("Error: cannot find the default printer.");
}
else
{
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
m_currentPageIndex = 0;
printDoc.Print();
}
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Dispose resources
/// </summary>
public void Dispose()
{
if (m_streams != null)
{
foreach (Stream stream in m_streams)
stream.Close();
m_streams = null;
}
}
}
}
0
確保您的SQL服務器升級到Service Pack 2.有幾個問題與ie10 +和SQL Server 2008R2 RTM的兼容性問題。
ReportViewer's Print Button Incompatible with IE 10?
The following table lists the major releases of SQL Server 2008 R2.
Release Product version
SQL Server 2008 R2 Service Pack 2 10.50.4000.0
SQL Server 2008 R2 Service Pack 1 10.50.2500.0
SQL Server 2008 R2 RTM 10.50.1600.1
Microsoft Article on Server Version
連接到SQL Server的實例,然後運行以下查詢:
Select @@version
0
此鏈接幫助我這麼多。
2路介紹:
1-安裝.NET 4.5。1 [http://www.microsoft.com/en-us/download/details.aspx?id=40773][1]
OR 2-添加瀏覽器文件作爲上述源說:
create a new Browser file in the App_Browsers folder in the root of your solution. Paste the following text in the file and then run. The issue should be solved.
<browsers>
<browser id="IE11Preview" parentID="Mozilla">
<identification>
<userAgent match="Trident/(?'layoutVersion'\d+).*rv:(?'revision'(?'major'\d+)(\.(?'minor'\d+)?))" />
<userAgent nonMatch="MSIE" />
<userAgent nonMatch="IEMobile" />
</identification>
<capabilities>
<capability name="browser" value="IE" />
<capability name="layoutEngine" value="Trident" />
<capability name="layoutEngineVersion" value="${layoutVersion}" />
<capability name="extra" value="${extra}" />
<capability name="isColor" value="true" />
<capability name="majorversion" value="${major}" />
<capability name="minorversion" value="${minor}" />
<capability name="screenBitDepth" value="8" />
<capability name="type" value="IE${major}" />
<capability name="version" value="${version}" />
<capability name="isColor" value="true" />
<capability name="screenBitDepth" value="8" />
<capability name="ecmascriptversion" value="3.0" />
<capability name="jscriptversion" value="6.0" />
<capability name="javascript" value="true" />
<capability name="javascriptversion" value="1.5" />
<capability name="w3cdomversion" value="1.0" />
<capability name="ExchangeOmaSupported" value="true" />
<capability name="activexcontrols" value="true" />
<capability name="backgroundsounds" value="true" />
<capability name="cookies" value="true" />
<capability name="frames" value="true" />
<capability name="javaapplets" value="true" />
<capability name="supportsCallback" value="true" />
<capability name="supportsFileUpload" value="true" />
<capability name="supportsMultilineTextBoxDisplay" value="true" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
<capability name="supportsVCard" value="true" />
<capability name="supportsXmlHttp" value="true" />
<capability name="tables" value="true" />
<capability name="supportsAccessKeyAttribute" value="true" />
<capability name="preferredRenderingType" value="html5" />
<capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
<capability name="vbscript" value="true" />
</capabilities>
</browser>
</browsers>
如果該問題已經存在,設置compatibility view setting
of IE11
。
相關問題
- 1. 打印按鈕在ReportViewer中不可見
- 2. 的ReportViewer打印按鈕
- 3. 如何使用reportviewer打印rdlc報告
- 4. 不使用默認打印按鈕打印水晶報告
- 5. 在ReportViewer C中更改打印按鈕的行爲#
- 6. ReportViewer在C#中按下「Enter」時打印
- 7. 打印不起作用在ReportViewer
- 8. 使用jquery按下打印按鈕時,css樣式不適用
- 9. 打印ReportViewer從自定義按鈕而不是工具欄
- 10. 如何在不使用RadEditor的打印按鈕的情況下調用打印功能RadEditor控件?
- 11. 使JavaScript按鈕打印值
- 12. 使用不同的按鈕打印不同的文檔
- 13. 在HtmlHelp中禁用打印按鈕
- 14. 使用C#窗口中的ReportViewer打印PDF
- 15. Ajax不能使用按鈕
- 16. Unslider不能使用按鈕
- 17. 不能使用android中的按鈕
- 18. 打印按鈕在Excel 2016中使用宏?
- 19. 使用報告查看器10.0.0.0打印rdlc,打印按鈕不顯示
- 20. 在.net打印預覽對話框中禁用「打印」按鈕
- 21. 使用Info()功能在ROOT中打印
- 22. ReportViewer打印問題
- 23. 如何使用c:中的asp:按鈕打印頁面
- 24. 如何使用Odoo9中的一個按鈕打印報告?
- 25. 無法在IE上使用php,javascript打印iframe,而是打印當前頁面而不是打印按鈕
- 26. 使用藍牙打印機在Android中打印不起作用
- 27. DataTables打印按鈕不起作用,打印一個空白頁
- 28. 不能使用cornerRadius按鈕在tabelfooter
- 29. ASP.Net不打印按鈕
- 30. 打印按鈕也在myprint上打印
感謝您的回答,它似乎是一個很好的解決方案。我只有1個問題實施它。你有沒有找到「默認打印機設置」的代碼有問題? ''if(!printDoc.PrinterSettings.IsValid) {0}拋出新的異常(「Error:can not find the default printer。」); }''這句話對我來說是個例外。 – jackncoke