Hi,
With FlexCel there is Aurelius example and conversion support is in AureliusFlexCelSupport-unit.
For blobs there is only asbytes (working for images) support:
if v0.TryAsType<TBlob>(Blob) then
I added already support for GUIDs as:
if v0.TryAsType<TGuid>(Guid) then
How to add support for blobs where is [DBTypeMemo] attribute?
BR,
Hannu
wlandgraf
(Wagner Landgraf)
April 7, 2016, 4:03am
2
The [DBTypeMemo] attribute just changes the way the blob is retrieved from the database, but from the blob/flexcel point of view, it works the same way, the type is still TBlob. Are you facing issues with it?
Yes, I have an issue with thin conversion.
Blob.AsBytes is working ok for images in xlsx template:
TFlexCelReport. Report.SetValue('TRAUMA_BMP', bTraumaBitmap);
Blob database field (nvarchar(max)) does not show anything in FlexCelReport. If I change that field to nvarchar(4000) it will work,
I thought maybe in version should be Blob. AsUnicodeString but how to implement it to recognize [DBTypeMemo] attribute in
function ConvertAureliusTypes(const v: TFlexCelDataConversionArgs; out r: TReportValue): boolean; ?
wlandgraf
(Wagner Landgraf)
April 8, 2016, 8:18pm
4
I got confused. Please provide detailed steps and info about what the problem is and how to reproduce it.
Blob.AsUnicodeString/AsString simply defines how the bytes will be saved internally in TBlob (it's always bytes, no string).
I refer to this demo-project FlexCelVCLNT\Demo\Delphi\Modules\20.Reports\A1.TMS Aurelius delivered with FlexCel.
It is easy to see what I mean:
Add to "TMS Aurelius.template.xls" <#Employees.Notes> to some cell in Employee-area.
It can not show anything because in AureliusFlexCelSupport.ConvertAureliusTypes is:
if v0.TryAsType<TBlob>(Blob) then
begin
r := Blob.AsBytes;
If I change the above line to r := Blob.AsUnicodeString; then TMSAurelius.dpr demo-project can show text blobs but not images.
So my question is how to implement ConvertAureliusTypes so that it can support both blobs, images (asBytes) and text (AsUniCodeString) types?
wlandgraf
(Wagner Landgraf)
April 12, 2016, 9:14am
6
If you just use images and strings, you can use the following code. This way, if the blob content has some image format it will be displayed as image, otherwise, the bytes will be converted to string using UNICODE encoding.
if v0.TryAsType<TBlob>(Blob) then begin if TImageUtils.GetImageType(Blob.AsBytes) <> TXlsImgType.Unknown then r := Blob.AsBytes
else r := Blob.AsUnicodeString;
exit(true); end;
Wagner R. Landgraf2016-04-12 11:54:34
Thanks Wagner, it's working now.
In demo project (Northwind.mdb database) I needed to remove OLEheader also:
if TImageUtils.GetImageType(TImageUtils.StripOLEHeader(Blob.AsBytes)) <> TXlsImgType.Unknown