Recent

Author Topic: Strange behaviour with XLSX files generated by Adobe Acrobat X  (Read 156 times)

heribertB

  • Newbie
  • Posts: 2
Strange behaviour with XLSX files generated by Adobe Acrobat X
« on: December 12, 2019, 09:02:19 am »
Hi,

I've just noticed that XLSX files generated by Adobe Acrobat X contain color value strings (??) that are already preceded by a #. Now, TsSpreadOOXMLReader.ReadColor does add another # to the beginning of this string when calling HTMLColorStrToColor, resulting in strtoint in HTMLColorStrToColor failing with an EConvertError.

My dowdy workaround was to start HTMLColorStrToColor with a check for this:

Code: Pascal  [Select]
  1. if pos ( '##' , avalue ) = 1 then delete ( avalue , 1 , 1 ) ;

Attached please find a sample.xlsx that should allow to reproduce that behaviour.

Regards

Heribert






wp

  • Hero Member
  • *****
  • Posts: 6646
Re: Strange behaviour with XLSX files generated by Adobe Acrobat X
« Reply #1 on: December 12, 2019, 10:38:51 am »
Could you please add the attachment? And can Adobe also create an OpenDocument file (.ods)? Send such a file, too. Maybe there is the same issue...

Pack both files into a common zip which is accepted by the forum software.
« Last Edit: December 12, 2019, 10:43:49 am by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

wp

  • Hero Member
  • *****
  • Posts: 6646
Re: Strange behaviour with XLSX files generated by Adobe Acrobat X
« Reply #2 on: December 12, 2019, 11:20:52 am »
Please test r7207. It reads a file correctly which I manipulated to have a # at the beginning of a color string. Interestingly Excel itself does not show this color correctly.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10