Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6164597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:01:20+00:00 2026-05-23T22:01:20+00:00

I have an application for viewing Word and Excel Files via Xps Viewer. I

  • 0

I have an application for viewing Word and Excel Files via Xps Viewer. I convert office files to xps files and show it in WPF XPS Document Viewer.

But here is a little problem; I don’t want the users see the files, i delete the files after closing.

I am wondering is there any solution to convert xps in to memory stream and view it in Xps Viewer

Edit:

I don’t want create any xps file on disk. The convert process must done inside to MemoryStream.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:01:21+00:00Added an answer on May 23, 2026 at 10:01 pm

    Following lines of code worked fine for me on a poc project and can give you a starting point.
    For the document conversion part (word/excel -> xps) you could just print them via automation using XPS Document Writer.

    System.IO.Stream docStream = ...any xps as stream;
    Package package = Package.Open(docStream);
    
    //Create URI for Xps Package
    //Any Uri will actually be fine here. It acts as a place holder for the
    //Uri of the package inside of the PackageStore
    string inMemoryPackageName = string.Format("memorystream://{0}.xps", Guid.NewGuid());
    Uri packageUri = new Uri(inMemoryPackageName);
    
    //Add package to PackageStore
    PackageStore.AddPackage(packageUri, package);
    
    XpsDocument xpsDoc = new XpsDocument(package, CompressionOption.Maximum, inMemoryPackageName);
    FixedDocumentSequence fixedDocumentSequence = xpsDoc.GetFixedDocumentSequence();
    
    // Do operations on xpsDoc here
    DocViewer.Document = fixedDocumentSequence;
    
    //Note: Please note that you must keep the Package object in PackageStore until you
    //are completely done with it since certain operations on XpsDocument can trigger
    //delayed resource loading from the package.
    
    //PackageStore.RemovePackage(packageUri);
    //xpsDoc.Close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made an application containing facility of viewing current location on map. I
In my application I have two tables (I have more but I'm only discussing
I have a problem in that my application works fine normally, but I have
Inside of my WPF application, I have embedded a WebBrowser control, which in turn
I have an html5/javascript application in which multiple users can be viewing the same
I have a problem with a photo viewing application I've written. I have a
I have an ASP.NET application that uses Session.SessionID to prevent multiple users viewing the
I have made a SVG image, or more like mini application, for viewing graphs
I have an XSLT for viewing XML files in the browser. The XSLT is
I have an android application for viewing 3D models. I could draw 3D models

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.