作成日: 2017/12/13 最終更新日: 2017/12/13
文書種別
制限事項
詳細
PrintToDocumentメソッドで作成したオブジェクトをWPF標準のDocumentViewerにセットして印刷すると、エラーが発生します。
これは、WPF標準のDocumentViewerの印刷がFixedDocumentのみをサポートするのに対して、PrintToDocumentメソッドで作成したオブジェクトがFixedDocumentでない(FixedDocumentの拡張)ために発生しています。
Spreadでは、印刷の精度を高めるため、独自に拡張を行っています。このため、この動作はSpreadの仕様上の制限となります。
これは、WPF標準のDocumentViewerの印刷がFixedDocumentのみをサポートするのに対して、PrintToDocumentメソッドで作成したオブジェクトがFixedDocumentでない(FixedDocumentの拡張)ために発生しています。
Spreadでは、印刷の精度を高めるため、独自に拡張を行っています。このため、この動作はSpreadの仕様上の制限となります。
回避方法
以下のように、DocumentViewerの印刷処理を変更します。
◎サンプルコード(XAML)
◎サンプルコード(VB.NET)
◎サンプルコード(C#)
◎サンプルコード(XAML)
<local:MyDocumentViewer x:Name="DocumentViewer1"/>
◎サンプルコード(VB.NET)
Public Class MyDocumentViewer Inherits DocumentViewer Public Property Owner As GcSpreadGrid Protected Overrides Sub OnPrintCommand() If Me.Owner IsNot Nothing Then Me.Owner.Print() End If End Sub End Class
◎サンプルコード(C#)
public class MyDocumentViewer : DocumentViewer
{
public GcSpreadGrid Owner { get; set; }
protected override void OnPrintCommand()
{
if (this.Owner != null)
{
this.Owner.Print();
}
}
}
旧文書番号
41437