Solved

Foxpro - How do I programmatically add a pic to an Excel SS

Posted on 2010-09-07
3
466 Views
Last Modified: 2012-05-10
I've been writing reports to Excel via Foxpro for years but unitl now I've never had to include an image.  This particual report concerns lab results where reference range explanations are quite long for two particular tests.  Since I need to provide all the results for an exam on one 8.5X11 sheet it's important that I not use one row per reference range line explanation and that's why I'm opting to include an image (see attached) instead.  I've also include a sample of the lab result report.  The list of test result is always different and may or may not include the two test results with the reference ranges that I've highlighted.  Please include your recommendations or a code sample.  Thanks in advance for your help.  For refrence, the change I'm incorporating is to an old VFP 6 application.
labsliptemplate.htm
HbA1c.jpg
0
Comment
Question by:NIDDK1550
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:jrbbldr
ID: 33621181
The place to start with anything like this is to do the same work manually in Excel and record the operations in an Excel Macro.

Then go into the Macro and examine the steps that it recorded.  Yes it will be in VBA code rather than VFP, but typically it is not too difficult to see what is going on and convert it to VFP Automation code.

Good Luck

0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33621493
No need to put this into an image, you can do multiline text into a cell by typing ALT+RETURN. In code you simply set a cell value to multiline text with CHR(10) as line feeds. I don't see why you would need pictures to do this.

Otherwise there is no such thing as a picture in a cell, pictures are put on a sheet as far as I found out. You can do ActiveSheet.Pictures.Insert ("C:\...\some.jpg") and the picture will be on the sheet, it can be positioned anywhere and is not bound to cells.

Bye, Olaf.
0
 
LVL 27

Accepted Solution

by:
CaptainCyril earned 500 total points
ID: 33622520
cMyPicture = SYS(5)+SYS(2003)+'logo.bmp' && a sample file

xlsheet.Columns(1).ColumnWidth = 4.25
xlsheet.Range("A1").Select
xlshape = xlsheet.Pictures.Insert(platformfile(cMyPicture)
WITH xlshape
*      .LockAspectRatio = msoTrue
      .Height = .Height*3/4 && three quarters of the logo's height
      .Width = .Width*3/4 && three quarters of the logo's width
ENDWITH
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question