We have an application in which admin members can add content to view their subordinates. Their requirement is that it should be able to display Word, Excel, PowerPoint and PDF documents in a non-editable manner.
One option I have found to do this is that content must be loaded on the web. The downside of the browser component is that it prompts the user to open / save / cancel, we are concerned that In subdued, most computers are illiterate, in this way there will be trouble opening the documents.
Using the above method also means that Microsoft Office and Adobe Acrobat (or other IE enabled PDF viewer) are needed
Is this content in C # on my form? Is there a better way to display?
Save XPS documents using Microsoft Office 2007 (or XPS printer to print them).
You can display a read-only XPS document by using the XPAs Viewer component in the PPG or JPEG image or render the page. It renders very easily 3.5 / WPF can be done using.
XpsDocument xpsDoc = New XpsDocument (xpsFileName, System.IO.FileAccess.Read); Fixed Document Sequence Dock Seek = Expedited Getfix Document Sequence (); Const Double Double Factor = 0.8; {DocumentPage docPage = docSeq.DocumentPaginator.GetPage (Page New) for (New page: Page; NumLt; docSeq.DocumentPaginator.PageCount; Page New ++); // Fix: There is a memory leak from calling GetPage without updating (docPage.Visual (Fixed Page) .UpdateLayout (); RenderTargetBitmap renderTarget = New RenderTargetBitmap ((int) Math.Round (scaleFactor * docPage.Size.Width), (int) Math.Round (Scale Factor * docPage.Size.Height), (Int.) Math. Round (Scale Factor * 96 ), (Int) math round (scale factor * 96), pixel format. Default); RenderTarget.Render (docPage.Visual); JPEGBitmap encoder encoder = new JPEG bitmap encoder (); Encoder Quality = 75; // Type here i.e.: JPEGBitmapEncoder, etc / bitmapEncoder encoder = new PngBitmapEncoder (); // Type here i.e.: JPEGBitmap encoder, etc. encoder.fr.ed. (bitmapfree.release (rendereragraj)); String Page Image File Name = String Format ("{0} - {1} .jpg", path.combin (path.gate directory name (xpsFileName), path.getfileName without extension (xpsFileName)), page news; (filestream pageoverstream = new filestream (page imagefilename , Filemode.ket, fileexerve.wereate)) (encoder.sev (pageostust);}} This code is required to reference, presentation framework and reference framework references.
/ P>
Edit: In the code above A memory leak (see). Examples have been included in the solution.
Comments
Post a Comment