Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Export a photo into Excel file
Message
From
03/07/2001 11:55:47
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/07/2001 03:46:05
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00526160
Message ID:
00526342
Views:
16
>Hi, everyone
>
>I want to generate a PRICE LIST from my database into EXCEL file format.
>I coding below command as below :-
>
>EXCEL_FILE.APPLICATION.CELLS(1,4).VALUE = "ITEM NO. : " + PRO_CODE
>
>now... i want to put a photo into CELLS(1,5), the photo was stord in database.field [MyProduct.photo]
>
>How ???
>
>I make it, cause i want to send the Price List (Excel) to my client with photo. If the Excel is not the best ways, what suggest for ?

Hs,
Honestly I would go with an HTML file. HTML or Excel your main problem is to get embedded pictures back as image files. To do that there are several ways and one is to copy general field to another temp table record by record, open its fpt lowlevel and get portion after offset 599. Or alternatively you could use copy from general and paste in excel too.

Assuming you have them on disk :
lcPhotoPath = _samples+'\data\graphics\'
Select last_name, first_name, title from employee into cursor crsEmp
Copy to myEmployee type xls
oExcel = createobject('Excel.Application')
With oExcel
  .Workbooks.Open(sys(5)+curdir()+'myEmployee.xls')
  With .ActiveWorkbook.Activesheet
  	.Cells(1,4).Value = 'Photo'
    Scan
      lcPhoto = lcPhotoPath+left(last_name,4)+left(first_name,4)+'.GIF'
      If file(lcPhoto) && Add photo if any
        .Range('D'+ltrim(str(recno()+1))).Select
        .Pictures.Insert(lcPhoto)
      Endif
    Endscan
    lnMaxWidth = 0
    lnRatio = fontmetric(19,'Arial',11)/fontmetric(6,'Arial',11)/72
    For each oShape in .Shapes
      oShape.LockAspectRatio = .T.
      oShape.Height = 72
      lnMaxWidth = max(lnMaxWidth,oShape.Width)
    Endfor
    .Range('A2:D'+ltrim(str(reccount()+1))).RowHeight = 72
    .Range('D:D').ColumnWidth = lnMaxWidth*lnRatio
    .Columns('A:C').VerticalAlignment = -4108
  Endwith
  .Visible = .t.
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform