Axelrako / excel-connector

Automatically exported from code.google.com/p/excel-connector
0 stars 0 forks source link

Product description cut after 1023 characters #24

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Insert/Update a product to the Products2 Table
2. Have a Product Description width more than 1023 chars

The expected result is a new/updated Product with the correct Description. 
Instead only the first 1023 characters of the description are transferred (the 
product description is a "long text" with 4000 character limit in salesforce).
If i update the product via the webinterface, everything works as intended.

Seen with Office 2010 on Windows 7 32bit with Salesforce EE

Original issue reported on code.google.com by xarum...@gmail.com on 2 Mar 2011 at 1:56

GoogleCodeExporter commented 8 years ago
Hi Xarumanx,

There is a hard-coded limit of 1023 set within the Excel connector code as 
Excel 2003 is limited to 1024 characters in a cell(refer to: 
http://office.microsoft.com/en-au/excel-help/excel-specifications-and-limits-HP0
05199291.aspx)

Excel 2007 
(http://office.microsoft.com/en-au/excel-help/excel-specifications-and-limits-HP
010073849.aspx) and Excel 2010 
(http://office.microsoft.com/en-au/excel-help/excel-specifications-and-limits-HP
010342495.aspx?CTT=1) do not have this limitation, but the code does not take 
this into account.

To allow additional string data to be recorded in higher versions, you can do a 
find/replace for 1023 to replace with 32766. In my case I added a constant as 
it made sense to document this limitation a little better.

The places to edit are:
Modules
         s_force
            (General)-(Declarations)
                ' Excel 2003 Cell String/Function Length Limit
                'Public Const maxCellText = 1023
                ' Excel 2007/2010 Cell String/Function Length Limit
                Public Const maxCellText = 32766

            Function query_row(sels As String, todo As Range)
                g_table.Cells(rw.row + 1 - g_table.row, j).Value = Left(so.Item(name).Value, maxCellText)

            Function label_value(so As SObject4, lab As String)
                label_value = Left(so.Item(name).Value, maxCellText)  ' avoid mem crash

         utils
            Sub format_write_row(g_body As Range, g_header As Range, g_sfd As SObject4, so As SObject4, row As Integer)
                .Cells(row, j).Value = Left(so.Item(name).Value, maxCellText)

I have not tested this change extensively, so it's worth double checking on 
your system that it works.

Original comment by arm...@intechnology.com.au on 17 Jan 2013 at 4:58