Too many columns (257)

How FlexCel detect column count, in my document only 74 columns with values. Other empty.
xls.ColCountInRow loop over all rows show columns count below 256.

After xls.InsertAndCopyRange(range, 1, 1, 1, TFlxInsertMode.ShiftColRight, TRangeCopyMode.Formats),
Save xls file interrupted with exception

FlexCel.XlsAdapter.FlexCelXlsAdapterException was unhandled
  HResult=-2146233088
  Message=Too many columns (257): The maximum number of columns supported by this file format is 256.
  Source=FlexCel
  StackTrace:
       at #c.#b.ThrowException(XlsErr , Object[] )
       at #c.#6h.#oIb(Int32 )
       at #c.#6h.#rIb(Int32 )
       at #c.#3l.#PZb(Stream , Boolean , Boolean , Int32 , Boolean )
       at #c.#3l.#r0b(Stream , Boolean , Int32 , Boolean , Int32 , Boolean )
       at #c.#3l.#Rnb(Stream , #0e )
       at #c.#3l.Add(Stream , Stream , #0e , #Mh , #9m , #vj , #2l , #BDc )
       at #c.#3l.#m0b(#fl #G4, #9m #d0, #2l #qJh, Int32& #rJh)
       at #c.#K.#Shb(#9m , #2l )
       at #c.#em.#clb()
       at #c.#em.#blb()
       at #c.#il.#wTb(#Xl , #0f , Int32 , TXlsCellRange )
       at #c.#il.#xnb(TXlsCellRange )
       at #c.#Ind.#xnb(TXlsCellRange )
       at #c.#il.#qnb()
       at #c.#ec.#Bnb()
       at #c.#ec.#blb(TXlsCellRange )
       at #c.#Uf.#Bnb()
       at #c.#Uf.#blb(TXlsCellRange )
       at #c.#9h.#XKb(TXlsCellRange )
       at #c.#9h.#blb(#Ak , Boolean )
       at #c.#zh.#8Eb(#Ak , Boolean )
       at #c.#zh.#Thb(#Xl , #0f )
       at FlexCel.XlsAdapter.XlsFile.Save(Stream aStream, TFileFormats fileFormat, Char delimiter, Encoding fileEncoding)
       at FlexCel.XlsAdapter.XlsFile.Save(String fileName, TFileFormats fileFormat, Char delimiter, Encoding fileEncoding)
       at FlexCel.Core.ExcelFile.Save(String fileName, TFileFormats fileFormat, Char delimiter)
       at FlexCel.Core.ExcelFile.Save(String fileName)
       at App.Program.Main(String[] args) in c:\Users\Alex\Documents\Visual Studio 2012\Projects\FlexCelTest\App\Program.cs:line 26
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Hi,

You probably have a formatted column at 256. Even if ColCountInRow returns < 256 (because there aren't any cells  at col 256), if the column is formatted in any way, say it has different width or a different color, or numeric format or anything, then that column would go to 257, and this would raise the error.

In the upcoming FlexCel 6 we are more forgiving on letting columns drop if they don't have important changes, so maybe this could be fixed.
If you want, send me an email to adrian@tmssoftware.com with your registration info and I can give you the latest beta to try. Or if you prefer, you can send me the file before inserting the column, and I can try it here to see if it is fixed.