Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Общие вопросы по .NET и C# > Печать Excel файла


Автор: Lеstat 27.6.2007, 14:09
Пишу программу на C#. Возникла необходимость распечатать файлик xls из своей программы.
Насколько я понял нужно как-то связать его с printDocument1, а затем уже и предварительный просмотр сделать можно и распечатать.
Подскажите пожалуйста как это можно сделать...
Спасибо!

Автор: Sanguine 29.6.2007, 17:50
Посмотри 
http://www.gotdotnet.ru/LearnDotNet/NETFramework/22054.aspx
С помощью этих tools с офисными документами можно делать вообще что угодно, но придется качать.

Автор: Gelis 30.6.2007, 13:06
У объекта Sheet есть метод PrintOut вот его описание из MSDN
Цитата

void PrintOut(
    [In, Optional] object From, 
    [In, Optional] object To, 
    [In, Optional] object Copies, 
    [In, Optional] object Preview, 
    [In, Optional] object ActivePrinter, 
    [In, Optional] object PrintToFile, 
    [In, Optional] object Collate, 
    [In, Optional] object PrToFileName
);
 
Parameters
From
Optional Object. The number of the page at which to start printing. If this argument is omitted, printing starts at the beginning.

To
Optional Object. The number of the last page to print. If this argument is omitted, printing ends with the last page.

Copies
Optional Object. The number of copies to print. If this argument is omitted, one copy is printed.

Preview
Optional Object. True to have Microsoft Excel invoke print preview before printing the object. False (or omitted) to print the object immediately.

ActivePrinter
Optional Object. Sets the name of the active printer.

PrintToFile
Optional Object. True to print to a file. If PrToFileName is not specified, Microsoft Excel prompts the user to enter the name of the output file.

Collate
Optional Object. True to collate multiple copies.

PrToFileName
Optional Object. If PrintToFile is set to True, this argument specifies the name of the file you want to print to.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)