簡體   English   中英

如何在應用程序啟動時將一個特定的 xps 文檔加載到 DocumentViewer 中進行閱讀而不加載它

[英]how to load one specific xps document into DocumentViewer for reading without loading it when application start

我只做了一個按鈕來添加一個文檔。 是否可以以某種方式從具有 Visual Studio 項目或其他內容的文件夾中加載文檔?

private void Load_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "XPS file (*.xps)|*.xps";

            if (ofd.ShowDialog() == true)
            {
                XpsDocument doc = new XpsDocument(ofd.FileName, FileAccess.Read);
                documentViewer.Document = doc.GetFixedDocumentSequence();
            }
        }
private void Book1_Click(object sender, RoutedEventArgs e)
        {
            var xpsDocument = new XpsDocument(@"C:documentPath", FileAccess.Read);
            documentViewer.Document = xpsDocument.GetFixedDocumentSequence();
        }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM