Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Error when loading protected workbook
posted

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()

Parents Reply Children