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
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
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
Thank you,
but how can I export my grid in the workbook?
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
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
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
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");
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");
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?
You can use the method : SetFileWriteProtectionPassword of the Workbook
Ex. exportWorkbook.SetFileWriteProtectionPassword("yourPassword");
Workbook and Worksheet protection support was added in 15.1. The latest volume release will also maintain this support.
I strongly recommend reading more about this on our online help page: http://help.infragistics.com/doc/WPF/2016.1/CLR4.0/?page=Whats_New_in_2015_Volume_1.html
Let me know if you have any questions regarding this matter or need assistance installing the latest volume.
hai,
I have infragistics 14.1 version. i need to set password for workSheet. It's Available in this version? or which version is may i download?
Yes, the method is accessible in 14.1. Our documentation prior to 14.1 does not include this and a few other methods exposed from the workbook class.
http://help.infragistics.com/doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Documents.Excel.v14.1~Infragistics.Documents.Excel.Workbook~SetFileWriteProtectionPassword.html
Michael DiFilippo said: Hello, You can use the method : SetFileWriteProtectionPassword of the Workbook Ex. exportWorkbook.SetFileWriteProtectionPassword("yourPassword");
I cannot find the method "SetFileWriteProtectionPassword": I'm using Infragistics 10.3: is it a new feature?