- protected void Button1_Click(object sender, EventArgs e)
- {
- // create a new instance of ServerTextControl
- using (TXTextControl.ServerTextControl tx =
- new TXTextControl.ServerTextControl())
- {
- // load the document
- tx.Create();
- tx.Load(Server.MapPath("/documents/sample.docx"),
- TXTextControl.StreamType.WordprocessingML);
- // save the document in the internal format to a byte array
- byte[] data;
- tx.Save(out data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
- // load the byte array into the read-only DocumentViewer
- DocumentViewer1.LoadDocumentFromMemory(data,
- TXTextControl.DocumentServer.FileFormat.InternalUnicodeFormat);
- }
- btn_DownloadDocument.Visible = true;
- }
复制代码 |