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,
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
Did you get a chance to look into it?
Hello Rajesh,
I was not able to work on that on Thursday and Friday last week, but I am continuing my investigation today and will keep you posted. Thank you for your patience and understanding.
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.