بلی متوجه شدم
اینم یه سمپل --تصویر اجرا شده رو هم میزارم
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Text;
using System.Windows.Forms;
namespace Html_csharp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var xDocument = new XDocument(
new XDocumentType("html", null, null, null),
new XElement("html",
new XElement("head"),
new XElement("body",
new XElement("p",
"تست html در سی شارپ ", new XElement("b", "bold"), " text."
),
new XElement("p",
"سی شارپ زبان نامحدودی است"
)
)
)
);
var settings = new XmlWriterSettings
{
OmitXmlDeclaration = true,
Indent = true,
IndentChars = "\t"
};
using (var writer = XmlWriter.Create(@"test.html", settings))
{
xDocument.WriteTo(writer);
}
}
}
}