Subsonic is going up in subsonic,
everyday we feel how subsonic is a very good tool.
They created a good visual tool called SubStage to easily generate code.
Subsonic is going up in subsonic,
everyday we feel how subsonic is a very good tool.
They created a good visual tool called SubStage to easily generate code.
You can open any excel file using code like this:
Process.Start(filePath);
But what will happen if we have these 2 lines of code:
Process.Start(filePathONE);
Process.Start(filePathTWO);
Will first open “filePathONE” in a new excel instance, then will open the “filePathTwo” in the same excel instance.
What we can do if we want to open each file in a separate new excel instance?
We must write it like that:
Process.Start(“Excel.exe”, filePathONE);
Process.Start(“Excel.exe”, filePathTWO);
It’s very simple, isn’t it?
But we can face a small problem with this way:
If you want to open an excel file that contains space in its name, for example “my Sheet.xls”, it will give you a runtime error that it can’t open files “my.xls” and “Sheet.xls”.
So what can I do?
It’s simple:
Just add “ before and after the file path, just like that:
Process.Start(“Excel.exe”, @“””filePathONE”””);
Like that it will open normally without any errors.
Note:
You will need to do the same for any office application (word, powerpoint, ….).
Posted by Amr at 8:24 PM 2 comments