We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells protected worksheet and ActiveX control

Hi there,


I’m trying to add and use an activex combobox in a protected worksheet. However, setting the ‘Locked’ property to false, seems to have no effect. If I open the resulting file in Excel, turn protection off and design mode on and then look at the combobox properties ‘Locked’ is set true.

Is this a bug, or am I doing something wrong?

Workbook wb = new Workbook();
Worksheet sheet = wb.Worksheets[0];
Style style;
StyleFlag flag;

for (int i = 0; i <= 255; i++)
{
style = sheet.Cells.Columns[(byte)i].Style;
style.IsLocked = false;
flag = new StyleFlag();
flag.Locked = true;
sheet.Cells.Columns[(byte)i].ApplyStyle(style, flag);
}

style = sheet.Cells.Columns[0].Style;
style.IsLocked = true;
flag = new StyleFlag();
flag.Locked = true;
sheet.Cells.Columns[0].ApplyStyle(style, flag);

Aspose.Cells.Drawing.Shape s = sheet.Shapes.AddActiveXControl(Aspose.Cells.Drawing.ActiveXControls.ControlType.ComboBox, 5, 0, 5, 0, 100, 20);
Aspose.Cells.Drawing.ActiveXControls.ComboBoxActiveXControl c = (Aspose.Cells.Drawing.ActiveXControls.ComboBoxActiveXControl)s.ActiveXControl;
s.ActiveXControl.IsLocked = false;
c.IsVisible = true;
c.BorderStyle = Aspose.Cells.Drawing.ActiveXControls.ControlBorderType.None;
c.Font.Name = “Arial”;
c.Font.Color = System.Drawing.Color.Black;
c.ListRows = 12;
c.MatchEntry = Aspose.Cells.Drawing.ActiveXControls.ControlMatchEntryType.None;

sheet.Protect(ProtectionType.All);
wb.Save(@“C:/Protected.xlsb”, SaveFormat.Xlsb);

Note: Using Cells 17.2.0.0

Hi,


Thanks for the sample code with details.

After an initial test, I observed the issue as you mentioned by using your sample code. I found that the “Locked” attribute of ActiveX control (ComboBox) is not changed while protecting worksheet in the output Excel file. I used your sample code to get the output XLSB file. I opened the output file into MS Excel (2007). Now turn protection off and select the ActiveX control in the worksheet. Click “Design Mode” in Developers tab, click the “Properties” and confirmed the “Locked” attribute is still “True” where it should be “False”. I have logged a ticket with an id “CELLSNET-45183” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

Hi,


This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-45183”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Once the fix is available for public use, we will share the Download link here.

Thank you.

Hi,

Please try our latest latest fix/version: Aspose.Cells for .NET v17.2.7:

Aspose.Cells for .NET (Latest Version)

Your issue should be fixed in it.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSNET-45183) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi,


I just tried both the version you posted and v17.3.0. I’m seeing the same results. Did you retest the code snippet I posted?

Hi,

Thanks for your feedback and using Aspose.Cells.

We were able to observe this issue and re-opened it. Please see the output excel file for your reference.

C#

wb.Save(@“Protected-” + CellsHelper.GetVersion() + “.xlsb”, SaveFormat.Xlsb);

Hi,


We are sorry for the inconvenience caused.

We have fixed the issue now. This time we will make sure it passes QA thoroughly, so we could share the fix with you here. We will soon get back to you with the fix.

Thank you.

Hi,

Please try our latest version/fix: Aspose.Cells for .NET (Latest Version).

Aspose.Cells for .NET (Latest Version)

(Note: please choose any of the fixes for your underlying .NET framework version)

Your issue should be fixed in it.

Let us know your feedback.

Thank you.

This version did work, Thank you.

Hi,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.