I want to load a protected workbook for readonly access. The spreadsheet I have has a password for "Protect Structure and Windows" set. This does not disallow the file from being opened, just from workbooks being added to the file. When I try to load the workbook, I get the error listed below. Is there a way around this? Will this be fixed in a later release? Attached is the file used(with the extension changed from xls to txt to allow uploading).
{"Attempted to read past the end of the stream."}
at Infragistics.Excel.Serialization.BiffRecordStream.ReadFormattedString(UInt16 stringLength) at Infragistics.Excel.Serialization.BiffRecordStream.ReadFormattedString(LengthType lengthType) at Infragistics.Excel.Serialization.BIFF8.BiffRecords.WRITEACCESSRecord.Load(BIFF8WorkbookSerializationManager manager) at Infragistics.Excel.Serialization.BIFF8.BIFF8WorkbookSerializationManager.LoadCurrentRecord() at Infragistics.Excel.Serialization.BIFF8.BIFF8WorkbookSerializationManager.LoadWorkbookContents() at Infragistics.Excel.Serialization.WorkbookSerializationManager.Load() at Infragistics.Excel.Workbook.LoadBIFF8File(Workbook workbook, Stream stream, String parameterName) at Infragistics.Excel.Workbook.LoadHelper(Stream stream, WorkbookFormat format, String parameterName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml) at Infragistics.Excel.Workbook.Load(String fileName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml) at Infragistics.Excel.Workbook.Load(String fileName, IPackageFactory packageFactory) at Infragistics.Excel.Workbook.Load(String fileName) at Compeat.WinForms.ImportJournalEntriesSpreadsheet.btnImportSelectedJournalEntryFiles_Click(Object sender, EventArgs e) in C:\Work\Compeat.NET\Compeat.WinForms\ImportJournalEntriesSpreadsheet.cs:line 204 at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Compeat.NET.Startup.Main(String[] args) in C:\Work\Compeat.NET\Compeat.NET\Startup.cs:line 181 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
This feature to open password protected workbooks is not yet implemented. I have forwarded this post to the Developer Support Manager to create a feature request on your behalf.
Hi,
Can you tell me if this feature has been implemented yet? If so what version do I need to download and if not is it planned to implement this feature?
Thanks,
Redrag.
Hi All,
We have been double-checking whether including encryption in our product is legal. It turns out that we can’t include this functionality ”reading the protected Excel files” in our Excel library due the US Export regulations around encryption. Though we have it implemented, we are not allowed to use encryption to open files in our product.
Let me know if you have any further questions.
Is there a way to save password protected spreadsheets?
As Dimi explained above, we cannot support this for legal reasons.
You may want to consult with OS2 because they're able to support encryption for PDF files in their PDF4NET product.