Skip to content

Commit

Permalink
Remove duplicated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
falleretic committed Mar 15, 2024
1 parent 4340a6f commit 2f86e19
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions Examples/ApiExamples/ApiExamples/ExDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,38 +113,6 @@ public void LoadFromStream()
//ExEnd
}

[Test]
public async Task LoadFromWebAsync()
{
//ExStart
//ExFor:Document.#ctor(Stream)
//ExSummary:Shows how to load a document from a URL.
// Create a URL that points to a Microsoft Word document.
const string url = "https://filesamples.com/samples/document/docx/sample3.docx";

// Download the document into a byte array, then load that array into a document using a memory stream.
using (HttpClient webClient = new HttpClient())
{
byte[] dataBytes = await webClient.GetByteArrayAsync(url);

using (MemoryStream byteStream = new MemoryStream(dataBytes))
{
Document doc = new Document(byteStream);

// At this stage, we can read and edit the document's contents and then save it to the local file system.
Assert.AreEqual("There are eight section headings in this document. At the beginning, \"Sample Document\" is a level 1 heading. " +
"The main section headings, such as \"Headings\" and \"Lists\" are level 2 headings. " +
"The Tables section contains two sub-headings, \"Simple Table\" and \"Complex Table,\" which are both level 3 headings.",
doc.FirstSection.Body.Paragraphs[3].GetText().Trim());

doc.Save(ArtifactsDir + "Document.LoadFromWeb.docx");
}
}
//ExEnd

await TestUtil.VerifyWebResponseStatusCodeAsync(HttpStatusCode.OK, url);
}

[Test]
public void LoadFromWeb()
{
Expand Down Expand Up @@ -484,39 +452,6 @@ public void OpenFromStreamWithBaseUri()
//ExEnd
}

[Test]
public async Task InsertHtmlFromWebPageAsync()
{
//ExStart
//ExFor:Document.#ctor(Stream, LoadOptions)
//ExFor:LoadOptions.#ctor(LoadFormat, String, String)
//ExFor:LoadFormat
//ExSummary:Shows how save a web page as a .docx file.
const string url = "https://products.aspose.com/words/";

using (HttpClient client = new HttpClient())
{
var bytes = await client.GetByteArrayAsync(url);
using (MemoryStream stream = new MemoryStream(bytes))
{
// The URL is used again as a baseUri to ensure that any relative image paths are retrieved correctly.
LoadOptions options = new LoadOptions(LoadFormat.Html, "", url);
options.Encoding = Encoding.UTF8;

// Load the HTML document from stream and pass the LoadOptions object.
Document doc = new Document(stream, options);

// At this stage, we can read and edit the document's contents and then save it to the local file system.
Assert.True(doc.GetText().Contains("HYPERLINK \"https://products.aspose.com/words/net/\" \\o \"Aspose.Words\"")); //ExSkip

doc.Save(ArtifactsDir + "Document.InsertHtmlFromWebPage.docx");
}
}
//ExEnd

await TestUtil.VerifyWebResponseStatusCodeAsync(HttpStatusCode.OK, url);
}

[Test]
public void InsertHtmlFromWebPage()
{
Expand Down

0 comments on commit 2f86e19

Please sign in to comment.