We are trying to display a web page in a windows form using web browser control. The web page that we are trying to open contains Excel export button, which is working fine in IE Edge browser and in chrome. But when trying to open it in web browser control in windows forms C# .Net application we are not getting any error message or not getting excel exported into the local folders. (In the below code it not even reaching success or error functions but is entering into exportStarting function). Below is the C# .Net code used
private void userSecurityToolStripMenuItem_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("URLofTheWebPage");
}
Below is the typescript code used
$(me.gridName).igGrid("option", "dataSource", me.data);
$.ig.GridExcelExporter.exportGrid($(me.gridName),
fileName: me.fileName,
worksheetName: me.workSheetName,
gridStyling: "applied",
gridFeatureOptions: { sorting: "applied" }
},
exportStarting: function (args:any):any {
var temp: any = this;
alert("Export Started");
args._gridData = me.data;
//debugger;
success: function () {
alert("Entered in to success");
error: function (error) {
//returns reference to the error object
alert("error");
);
Hi Rajesh,
If exportStarting is hit, but success or error are not, it seems like something breaks the execution of the code (like an error). IS there any chance that you provide us with a working sample reproducing the issue that we can investigate on our side ?
Thank you for the provided sample.
I am able to run the html page and export the grid, but I assume the other project consumes this file somehow, though I was not able to determine how. Please provide details about how this project consumes the html, so that I can run it on my side.
Hi,
You might have to install Visual Studio 2015(VS2015) to open the other project. after you install VS2015 go into ExcelExport_webBrowser folder and open "ExcelExport_webBrowser.sln". After opening the project you have to open the file "Form1.cs" and update the below code with the URL of the html page that you were able to run.
webBrowser1.Navigate(@"C:\Users\vemulr\Downloads\igGridExcelExport\igGridExcelexport1.html");
press F5 to run the project in VS2015 and you will see a windows form opening and after couple of seconds you will see the form running with html page. Now when you try to export the grid we are getting an error.
If you still can't run the project. Please let me know your Email ID and i will send you the screenshots of the above process.
Thank you for the guidance, I have been able to run the grid on the win form and was able to reproduce the error on exporting. I am currently investigating this behavior and will keep you updated on my progress.
Did you get a chance to look into it?
The WebBrowser within the WinForms project embeds a version of Internet Explorer, however this embedded version has features cutted, which prevents the igGridExcelExporter to save the file as it would on other browser.
Downloading the file in IE falls back to the navigator.msSaveOrOpenBlob function, which is native to IE, however this function is not available in the embedded browser. Please use the attached file to replace it in the project and see that navigator.msSaveOrOpenBlob is undefined. All the file does is:
function downloadFile() { var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); alert(navigator.msSaveBlob); alert(navigator.msSaveOrOpenBlob); navigator.msSaveOrOpenBlob(blob, "hello world.txt"); }
This is what igGridExcelExporter falls back to when creating the excel file - creating a blob object and passing it to the msSaveOrOpenBlob function for IE.
igGridExcelexport1.zip