Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all i have creatd small application. that application will print text file which i mention in my coding. but the problem is i want to print text file from one folder, if that folder contains N no of text file.. that all text file shld be print
throught out coding pls give me some idea as well as some example coding. it will be highly greatful for me
Posted

you need to send each file to to printer by print command.... watch this code :

http://www.andreavb.com/forum/viewtopic_1963.html[^]
 
Share this answer
 
Comments
sameertm 20-Aug-11 13:58pm    
hi for example i have one folder that folder contain 10 text file with differnt name, what i have to do is. i have to print all this text file one by one through c# coding .. u have any solution for it
You have to code as per your custom needs

Add System.IO namespace to ur program

use GetFiles method of Directory Class to get files from directory

then send each file for printing

[edit] removed the txtspk [/edit]
 
Share this answer
 
v2
This could be of great help: Directory.GetFiles Method[^]
 
Share this answer
 
Try as below code.

C#
string myFolder = Server.MapPath("MyFolderName");
string[] filePaths = System.IO.Directory.GetFiles(myFolder);
System.Text.StringBuilder allFileText = new System.Text.StringBuilder();
System.IO.StreamReader streamReader = null;
        
   foreach (string filePath in filePaths)
   {
            if (System.IO.File.Exists(filePath))
            {
                streamReader = new System.IO.StreamReader(filePath);
                allFileText.Append(streamReader.ReadToEnd());
            }
            streamReader.Close();
            streamReader.Dispose();
   }
 
Share this answer
 
Comments
CHAITANYA KIRAN KASANI 21-Nov-12 4:56am    
May I Know What Happens With This COde....it only read the files From The Folder and how it will print the files directly ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900