Zdravim. Mam problem s vkladanim textu do wordoveho suboru. Chcel by som vkladat text tak aby mal roznu vysku, pripadne farbu. Probelm je vsak v tom ze vzdy ma text taku vysku aku som nastavil naposledy...
Takyto kod pouzivam:
foreach (string filename in ofd.FileNames)
{
// now add the picture in active document reference
doc.InlineShapes.AddPicture(filename, Type.Missing, Type.Missing, Type.Missing);
Microsoft.Office.Interop.Word.Range r = doc.Range();
r.Font.Size = 12;
r.InsertBefore("Nadpis");
Microsoft.Office.Interop.Word.Range r2 = doc.Range();
r2.Font.Size = 25;
r2.InsertAfter("popis");
}
}
// file is saved.
doc.SaveAs("d:\\hello.doc", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
// application is now quit.
WordApp.Quit(Type.Missing, Type.Missing, Type.Missing);