Hello,
is it possible to export an ultrawingrid to Excel file in protected mode (without allowing the user to modify the file created)?
Thanks in advance
Michael DiFilippo said: Hello, You can export your grid data to a read only excel file by creating a workbook and a worksheet and setting the Protected property off of the worksheet to true. I attached a sample demonstrating this. Here is the code snippet that I used: String[] arrStore = new string[] { "one", "two", "three" }; this.ultraGrid1.DataSource = arrStore; Workbook exportWorkbook = new Workbook(); Worksheet exportWorksheet = exportWorkbook.Worksheets.Add("Export"); //Set workbook or specific worksheet to be read only. exportWorkbook.Protected = true; exportWorksheet.Protected = true; this.ultraGridExcelExporter1.Export(this.ultraGrid1, exportWorksheet); exportWorkbook.Save("C:\\GridData.xls");
You can export your grid data to a read only excel file by creating a workbook and a worksheet and setting the Protected property off of the worksheet to true. I attached a sample demonstrating this. Here is the code snippet that I used:
String[] arrStore = new string[] { "one", "two", "three" };
this.ultraGrid1.DataSource = arrStore;
Workbook exportWorkbook = new Workbook();
Worksheet exportWorksheet = exportWorkbook.Worksheets.Add("Export");
//Set workbook or specific worksheet to be read only.
exportWorkbook.Protected = true; exportWorksheet.Protected = true;
this.ultraGridExcelExporter1.Export(this.ultraGrid1, exportWorksheet); exportWorkbook.Save("C:\\GridData.xls");
Thank you, it works, but I have another question :-)
Now everybody can remove the protection opening the file with Excel (menu Revision -> remove protection): is it possible to set a password to avoid this?
Michael DiFilippo said: Hello, You can use our UltraGridExcelExporter component in conjunction without UltraGrid to export the cell data to a worksheet. We have a sample demonstrated in our documentation here: http://help.infragistics.com/Help/Doc/WinForms/2013.2/CLR4.0/html/WinGridExcelExporter_Export_Grid_Data_To_Excel.html
You can use our UltraGridExcelExporter component in conjunction without UltraGrid to export the cell data to a worksheet. We have a sample demonstrated in our documentation here:
http://help.infragistics.com/Help/Doc/WinForms/2013.2/CLR4.0/html/WinGridExcelExporter_Export_Grid_Data_To_Excel.html
Hi,
I know this, but I dont'now how to set the file xls as protected to avoid any modification by the user
Thank you
Michael DiFilippo said: Hello, You can use the Protected property when designing your workbook to indicate that it will be protected. Setting this property to True changes the worksheet and it's cells to be locked. http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Documents.Excel.v14.1~Infragistics.Documents.Excel.Workbook~Protected.html Example here: http://es.infragistics.com/community/forums/t/9912.aspx
You can use the Protected property when designing your workbook to indicate that it will be protected. Setting this property to True changes the worksheet and it's cells to be locked.
http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Documents.Excel.v14.1~Infragistics.Documents.Excel.Workbook~Protected.html
Example here:
http://es.infragistics.com/community/forums/t/9912.aspx
Thank you,
but how can I export my grid in the workbook?