Csharp/C Sharp/Windows/Word — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 14:43, 26 мая 2010
Set word document style
<source lang="csharp"> using System; class MainClass {
private static object n = Type.Missing; static void Main(string[] args) { Word.ApplicationClass app = new Word.ApplicationClass(); app.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone; Word.Document doc = app.Documents.Add(ref n, ref n, ref n, ref n); Word.Range range = doc.Paragraphs.Add(ref n).Range; range.InsertBefore("Test Document"); string style = "Heading 1"; object objStyle = style; range.set_Style(ref objStyle); range = doc.Paragraphs.Add(ref n).Range; range.InsertBefore("Line one.\nLine two."); range.Font.Bold = 1; doc.PrintPreview(); app.Visible = true; }
}
</source>