Page 1 of 1
Can i get any sample code for trasfering data to MS Excel
Posted: Fri Oct 23, 2009 6:54 am
Can any one help me with any sample code, for transfering data to Excel and getting it back using widgets. Something like Import/Export To and From text file ??
Posted: Fri Oct 23, 2009 5:54 pm
You might need to be a little more specific in what you want to transfer to and from Excel.
Also, are you talking about transferring data with a running instance of Excel or with an Excel file? In the former case you would probably need to use the wxAutomation stuff. In the latter case, you might need to look into something like this:
Posted: Thu Jul 29, 2010 7:36 pm
Of course, and some knowledgeable people among http://www.hasbro.com/en_GB/my-little-pony
can help you with this
Posted: Wed Sep 29, 2010 5:01 pm
Code: Select all
void Diet_ManagerFrm::MenuexportClick(wxCommandEvent& event)
// ExportDialog dlg(this);
wxString prompt = wxT("Please Select the Dieter to Export Records for");
wxSingleChoiceDialog dlg(NULL,prompt,wxT("Export who?"),DieterArray);
wxFileDialog filedlg(NULL,"Choose the destination file","My Documents","","*.csv",wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
if (dlg.ShowModal() != wxID_OK) return;
Dieter = DieterArray[dlg.GetSelection()];
// if (selections.GetCount() < 1) return; //should not happen
if (filedlg.ShowModal() != wxID_OK) return;
wxString path = filedlg.GetPath();
file.AddLine("Date , Dieter, Meal Name,Calories,Total Fat,Saturated Fat,Trans Fat,Cholesterol,"
"Sodium,Carbohydrate,Fiber,Sugar,Protein,Vitamin A,Vitamin C,Vitamin D,"
for (n=0; n < count; ++n)
The "ToString" method of the array just outputs the data as a comma separated string. There's probably a better way, but this is working code.
Import would be similar (I didn't implement import).