-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Hello Marco,
I tried to submit a pull request but I couldn't succeed. So I add the new version of RunExcelProcess down below.
I added a file dialog in order to select an Excel template file.
If cancel button is pressed, an empty file is open (previous behaviour).
The template file can be created from an empty file. Open connection properties and check these 2 options :
- in first tab : refresh data when the file is open
- in second tab : always use the connection file
When the template is open from external tools, data is refreshed automatically without any message.
Thanks again for this fantastic tool
Didier Terrien
`
private void RunExcelProcess(string serverName, string databaseName, string cubeName)
{
// Create ODC file
OdcHelper.CreateOdcFile(serverName, databaseName, cubeName);
var ODCfileName = OdcHelper.OdcFilePath();
// Select an Excel template. If Cancel button is pressed, an empty Excel file is opened
string selectedFileName = "";
OpenFileDialog openFileDialog = new OpenFileDialog
{
Title = "Select an Excel template file",
//InitialDirectory = Directory.GetParent(Power_BI_file).ToString(), //would be nice to start searching from the Power BI file folder
Filter = "xlsx files (*.xlsx)|*.xlsx|xlsm files (*.xlsm)|*.xlsm|All files (*.*)|*.*",
FilterIndex = 2,
Multiselect = false,
RestoreDirectory = true
};
if (openFileDialog.ShowDialog() == true)
{
// If ok is pressed, get the path of selected file
selectedFileName = openFileDialog.FileName;
}
else
{
// If Cancel is pressed, use the ODC file
selectedFileName = ODCfileName;
}
var p = new Process
{
StartInfo = new ProcessStartInfo(selectedFileName)
{
UseShellExecute = true
}
};
p.Start();
}
`
Metadata
Metadata
Assignees
Labels
No labels