I'm looking for a way to print all files in a given directory. Each file will be an Excel doc created by my program.
I have tried using PrintDocument but couldn't figure out how I actually specify to PrintDocument which file it should be printing...
private void PrintSheets(string filepath)
{
//get directory
DirectoryInfo dirInfo = new DirectoryInfo(filepath);
//get all files in directory
FileInfo[] Files = dirInfo.GetFiles();
//loop through files
foreach (FileInfo file in Files)
{
//create new print doc
PrintDocument printDocument = new PrintDocument();
//select printer
printDocument.PrinterSettings.PrinterName = cmbSelectPrinter.SelectedItem.ToString();
//set filename document
printDocument.DocumentName = file.Name;
//print the doc
printDocument.Print();
}
}
Any help appreciated. Thanks!