[ic] XLS import failure - 255 character limit issue.

Reid Sutherland interchange-users@icdevgroup.org
Wed Sep 4 17:11:01 2002


This is a multi-part message in MIME format.
--------------050406060107030407010108
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Reid Sutherland wrote:
> Hi,
> 
> I've having an issue where I'm trying to import an Excel 97+ spreadsheet 
>  into IC.  The problem is that IC takes a violent fit when the 
> description/comment field is over 255 characters.  It will start to push 
> MySQL errors.  Now I'm from me looking at the 
> UI/usertags/import_fields.tag, I don't see anything that would cause any 
> fields to be truncated/filled with upper ASCII chars by IC.  But then 
> again the code is very well written, making it painful for me to read :)
> 

I've completed testing on the problem I mentioned above.  I've concluded 
that there is no 255 character per field limitation, which is very 
obvious to me now.  The problem is when you have 'newline(s)' in any 
given row.

It seems a customer of mine was cutting and pasting HTML into the 
comment field in Excel.  This would keep any newlines from the HTML, and 
would produce the error during import.

I have taken Mike's code and created a patch for the UI.  If you do 
apply the patch, don't forget to restart Interchange.

Hope this helps,

-reid

--------------050406060107030407010108
Content-Type: text/plain;
 name="interchange-excelimportfix.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="interchange-excelimportfix.diff"

--- import_fields.tag-orig	Wed Sep  4 12:57:06 2002
+++ import_fields.tag	Wed Sep  4 13:36:57 2002
@@ -98,7 +98,9 @@
 								push @out, "";
 								next;
 							}
-							push @out, $row->[$iC]->Value;
+							my $v = $row->[$iC]->Value;
+							$v =~ tr/\n/\r/;
+							push @out, $v;
 						  }
 						  $sheets->{$sname} .= join "\t", @out;
 						  $sheets->{$sname} .= "\n";

--------------050406060107030407010108--