Read diffrent formats file in MFC.
-
Hi all, i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file,and inserts these values in ListCtrl of dialog box. please tell me how can i do this. please help me for this. if possible please explain me with example. thanks in advance.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
-
Hi all, i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file,and inserts these values in ListCtrl of dialog box. please tell me how can i do this. please help me for this. if possible please explain me with example. thanks in advance.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
"_$h@nky_" wrote:
i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file
Fine.
"_$h@nky_" wrote:
nd inserts these values in ListCtrl of dialog box.
What values? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
"_$h@nky_" wrote:
i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file
Fine.
"_$h@nky_" wrote:
nd inserts these values in ListCtrl of dialog box.
What values? :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
CPallini wrote:
"_$h@nky_" wrote: nd inserts these values in ListCtrl of dialog box. What values?
means file data.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
And why do you want to do that? For instance, what is the rationale behind putting the content of a
PDF
document into a list control item? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi all, i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file,and inserts these values in ListCtrl of dialog box. please tell me how can i do this. please help me for this. if possible please explain me with example. thanks in advance.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
You can read .txt, and .csv with relative ease (CFile, if you're using MFC). Other formats are not text-based and you will need to use the respective APIs/techniques to access those. I can think of office automation for reading .xls and .doc files, and haru[^] to deal with .pdf files. There are some articles that demonstrate reading from .doc and .xls, etc., files here at CP and you could do a search to find them out.
It is a crappy thing, but it's life -^ Carlo Pallini
-
Hi all, i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file,and inserts these values in ListCtrl of dialog box. please tell me how can i do this. please help me for this. if possible please explain me with example. thanks in advance.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
Hi Dude, You try the following Code, hope it can help u reading the files. Try to reduce the code, its too lengthy.... /****** This function is made to search a given string in the file and returns 1 or 0 *****/ int Search_Tag(char* input_line, char* tag_value) { int tag_len=0; Flag=FAIL; while(*input_line !='\n') { if(*tag_value=='\0') break; else { while(*tag_value!='\0') { if (*input_line==*tag_value) { input_line++; tag_value++; Flag=PASS; } else { Flag=FAIL; input_line++; tag_value++; } } } } if(Flag==FAIL) return FAIL; else return PASS; } /******This function searches the next occurance of the given string in the file******/ GetNext(FILE *ptr_read_file, char *str) { while(1) { fgets(line_buffer, 200, ptr_read_file); // read the input file line by line if(Search_Tag(line_buffer, str)) { break; } } return 0; } /***** This function traverses through the whole file and gives the position of the given strings *****/ int Search(FILE *ptr_read_file, char *str1, char* str2) { while(1) { fgets(line_buffer, 200, ptr_read_file); // read the input file line by line if(Search_Tag(line_buffer, str1)) { GetNext(ptr_read_file, str2); //Find Second Parameter break; } } return 0; } /*********** Reading the File *************/ void CABCDlg::OnButton1() { // TODO: Add your control notification handler code here ctr++; if(ctr == 1) { fp1 = fopen("File 1.txt","r"); //if the file doesnot exist or cannot be opened then return if(fp1 == NULL) { MessageBox("File Not found 'File 1.txt' Check source directory and try again...","Error",0); ctr--; return; } fp2 = fopen("File 1.txt","r"); fp3 = fopen("File 1.txt","r"); Search(fp3, "Object number: 2", "Message contents"); fgets(line_buffer, 200, fp3); /*********** READ 1st Four Bits From the File *********/ for(i=0; i<4; i++) { msg[i] = (fgetc(fp3)); } m_txt1 = msg; UpdateData(FALSE); } } ** Similarly u can read the .csv(dot csv) files as well. Note: Save the files in the same folder where .dsw was saved, to save the search time. All the best :) :)
French is the language of love, for everything else there is c++ ...(anonymous)
-
Hi all, i want to read diffrents formats(like: txt,doc,xls,csv,pdf etc) file,and inserts these values in ListCtrl of dialog box. please tell me how can i do this. please help me for this. if possible please explain me with example. thanks in advance.
To accomplish great things, we must not only act, but also dream; not only plan, but also believe.
You need to some library for them(you can find articles for pdf on the codeproject).
Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )