Teenuse .NET arendajad saavad hõlpsasti luua HTML, kasutades ainult meie võimsat toote API t. See tähendab, et meie lahendus pakub programmeerijatele kõike, mida nad vajavad HTML loomiseks rakenduses C#.
Meie C# teegi abil saavad arendajad HTML lihtsalt nullist luua. Selleks peavad .NET i arendajad tegema vaid mõne sammu:
Väärib märkimist, et tühi dokument peaks tehniliselt sisaldama ühte lõiku, nii et programmiliselt HTML dokumendi loomisel saate täpselt selle dokumendi põhistruktuuri.
Pange tähele, et saate vastloodud HTML failile sisu koheselt lisada. Nii saate mitte ainult tühja dokumendi, vaid vajaliku sisuga dokumendi. Lisateavet dokumendi redigeerimise kohta leiate lehelt Redigeerimine.
See .NET i teek võimaldab programmiliselt luua HTML dokumente. Proovige meie võimsat funktsiooni ja vaadake, kuidas järgmise näite abil mõnes vormingus HTML luua:
dotnet add package Aspose.Words
Kopeeri
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var font = builder.Font;
font.Name = "Courier New";
font.Color = Color.Blue;
font.Size = 36;
font.HighlightColor = Color.Yellow;
builder.Write("Morbi enim nunc faucibus a.");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.html", saveOptions);
using Aspose.Words;
var doc = new Document();
var run = new Run(doc, "Proin eros metus, sagittis sed.");
var para = doc.FirstSection.Body.FirstParagraph;
para.AppendChild(run);
var comment = new Comment(doc)
{
Author = "John Doe",
Initial = "JD",
DateTime = DateTime.Now
};
comment.SetText("Quisque fringilla leo.");
var commentRangeStart = new CommentRangeStart(doc, comment.Id);
var commentRangeEnd = new CommentRangeEnd(doc, comment.Id);
run.ParentNode.InsertBefore(commentRangeStart, run);
run.ParentNode.InsertAfter(commentRangeEnd, run);
commentRangeEnd.ParentNode.InsertAfter(comment, commentRangeEnd);
comment.AddReply("Jane Doe", "JD", DateTime.Now, "Pellentesque vel sapien justo.");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.html", saveOptions);
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.html", saveOptions);
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
Shape shape = builder.InsertChart(ChartType.Pie, 432, 252);
Chart chart = shape.Chart;
chart.Title.Text = "Demo Chart";
chart.Series.Clear();
chart.Series.Add("Series 1",
new string[] { "Category1", "Category2", "Category3" },
new double[] { 2.7, 3.2, 0.8 });
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
doc.Save("Output.html");
using Aspose.Words;
var doc = new Document();
var builder = new DocumentBuilder(doc);
var firstRun = new Run(doc, "Proin eros metus, sagittis sed. ");
var secondRun = new Run(doc, "Morbi enim nunc faucibus a.");
doc.FirstSection.Body.FirstParagraph.AppendChild(firstRun);
doc.FirstSection.Body.FirstParagraph.AppendChild(secondRun);
builder.MoveTo(secondRun);
builder.StartBookmark("Aspose bookmark");
// Kui NextSibling on null, siis tõenäoliselt on see lõigu viimane Run .
if (secondRun.NextSibling != null)
builder.MoveTo(secondRun.NextSibling);
else
builder.MoveTo(secondRun.ParentParagraph);
builder.EndBookmark("Aspose bookmark");
var saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.BookmarksOutlineLevels.Add("Aspose bookmark", 1);
doc.Save("Output.html", saveOptions);
Aspose.Words for .NET installimiseks oma süsteemi on kolm alternatiivset võimalust. Valige üks, mis sarnaneb teie vajadustega, ja järgige samm-sammult juhiseid:
Meie toode on täielikult platvormideülene ja toetab kõiki peamisi .NET-i rakendusi:
Kuna .NET-kood ei sõltu aluseks olevast riistvarast või operatsioonisüsteemist, vaid ainult virtuaalmasinast, võite vabalt arendada mis tahes tarkvara Windowsi, macOS-i, Androidi, iOS-i ja Linuxi jaoks. Lihtsalt veenduge, et oleksite installinud vastava .NET Framework, .NET Core, Windows Azure, Mono või Xamarin versiooni.
C#, F#, VB.NET rakenduste loomiseks soovitame kasutada Microsoft Visual Studio, Xamarini ja MonoDevelopi integreeritud arenduskeskkondi.
Lisateavet leiate toote dokumentatsioonist.
Saate luua dokumente muudes failivormingutes: