1

I want to develop a small tool which for open XML file and launch Excel automatically. The benefit for user who could save the excel file to .xls format very conveniently.

My Dev IDE: Windows XP pro & Visual Studio 2005.

The tool will running at Windows 2000 & Excel 2000. and there is no .net framework installed.

That means i can't code with C#. My choice is C++.

1

4 Answers 4

6

Oneliner:

int main() {
    system("Start Excel test.xml");
}
Sign up to request clarification or add additional context in comments.

4 Comments

We have the sme app in my company, it's called... mm... a human-being =)
Hi MSalters, Good day. I test like your said. but i really not good effect. 1st. I want to parser my XML with some C++ functions. 2nd. i want to convert the passer result data to .csv. 3rd. i could take user your guide to start my .csv with my Excel file. Any more suggestion? Thank you in advance. BR Nano
Still trivial - read XML (any parser will do), process as desired, write .csv file, call system("start Excel test.csv");
0

If I recall correctly you want to open an excel file and then auto launch xml editor?

A way is to add a option the the contect menu when rightclicking on the xls file.

Use register for this: HKEY_CLASSES_ROOT.xls\shell\

create a key (Default) and value something like "Open excel and xml editor" create a folder "command" and a key (Default) with value "path to your exe" "%L" in that folder.

Then in your app catch the param (which holds the xls) and then do something like this:

system(<var holding the xls name>);
system(<path to xml editor>):

Comments

0

You could use ShellExecute. It will automatically start program which associated with certain extension, or you could select program manually.

Comments

0

In C#

OpenXML in MSDN - http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.openxml(v=office.11).aspx

using Excel = Microsoft.Office.Interop.Excel;

string workbookPath= @"C:\temp\Results_2013Apr02_110133_6692.xml";

            this.lblResultFile.Text = string.Format(@" File:{0}",workbookPath);
            if (File.Exists(workbookPath))
            {
                Excel.Application excelApp = new Excel.Application();
                excelApp.Visible = true;
                Excel.Workbook excelWorkbook = excelApp.Workbooks.OpenXML(workbookPath, Type.Missing, Excel.XlXmlLoadOption.xlXmlLoadPromptUser);
            }
            else
            {
                MessageBox.Show(String.Format("File:{0} does not exists", workbookPath));
            }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.