ApiExamples.ExDocument.OpenDocumentFromWeb C# (CSharp) Метод

OpenDocumentFromWeb() приватный Метод

private OpenDocumentFromWeb ( ) : void
Результат void
        public void OpenDocumentFromWeb()
        {
            //ExStart
            //ExFor:Document.#ctor(Stream)
            //ExSummary:Retrieves a document from a URL and saves it to disk in a different format.
            // This is the URL address pointing to where to find the document.
            string url = "http://www.aspose.com/demos/.net-components/aspose.words/csharp/general/Common/Documents/DinnerInvitationDemo.doc";

            // The easiest way to load our document from the internet is make use of the 
            // System.Net.WebClient class. Create an instance of it and pass the URL
            // to download from.
            WebClient webClient = new WebClient();

            // Download the bytes from the location referenced by the URL.
            byte[] dataBytes = webClient.DownloadData(url);

            // Wrap the bytes representing the document in memory into a MemoryStream object.
            MemoryStream byteStream = new MemoryStream(dataBytes);

            // Load this memory stream into a new Aspose.Words Document.
            // The file format of the passed data is inferred from the content of the bytes itself. 
            // You can load any document format supported by Aspose.Words in the same way.
            Document doc = new Document(byteStream);

            // Convert the document to any format supported by Aspose.Words.
            doc.Save(MyDir + @"\Artifacts\Document.OpenFromWeb.docx");
            //ExEnd
        }
ExDocument