Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Excel: picture
#1
i have a a simple sheet with a picture in the first column.

Code:
Copy      Help
str a1 b1
ExcelSheet es.Init("Sheet1" 8 "F:\arne\tests\Book1.xlsx")
es.GetCell(a1 1 1)
es.GetCell(b1 2 1)
out a1
out b1

qm is returning nothing in a1.

what is more important for me:

how do i add a picture to a sheet and adjust the height of the row,
so that the picture fits in ?

btw is it possible to create .xls ?
my application is sending a query to a mdb and some of the values
have to be exported as excel document.

thanks and sorry,
i am new to the excel stuff.
pi
#2
I think pictures don't belong to cells.

When you don't know how to automate Excel using QM, try to record in Excel what you want to do. Then either run the Excel macro from QM (es.ws.Application.Run("Macro1")), or paste the VB code in QM and make some changes.

Code:
Copy      Help
ExcelSheet es.Init
IDispatch ws=es.ws ;;use IDispatch because then is easier to make Excel macro work in QM

ws.Range("B2").Select
Excel.Picture p=ws.Pictures.Insert("c:\windows\soap bubbles.bmp")
ws.Rows("2:2").RowHeight = p.Height
ws.Columns("B:B").ColumnWidth = p.Width/5.3 ;;p.Width is in pixels whereas ColumnWidth is characters...

Quote:is it possible to create .xls

Code:
Copy      Help
Excel.Application a._create
Excel.Workbook b=a.Workbooks.Add()
ExcelSheet es.ws=b.Worksheets.Item(1)
es.SetCell("test value" 4 2)
str f.expandpath("$personal$\test45.xls")
del f; err
b.SaveAs(f @ @ @ @ @ 1)
#3
thanks for the examples.

Gintaras Wrote:I think pictures don't belong to cells.

why not ?

my client wants to send to his client an excel document with
a product image in the first cell of a row.
in the following columns are details and prices which will be
changed by his client.

my first idea was to use pdf, but excel sheets are better to edit.

just out of curiosity: can a xls be created without having office
installed ?
pi
#4
Quote:just out of curiosity: can a xls be created without having office
installed ?

Yes.... I have an ebay bidding (snip) software that saves in xls formate and it will do this even without office installed[/quote]
#5
Quote:qm is returning nothing in a1
Quote:why not ?

In Excel object model, a cell is a Range object. I cannot find its properties related to Picture object. A Picture object has two properties TopLeftCell and BottomRightCell, which says that it does not belong to a single cell.

Quote:can a xls be created without having office
installed ?

Don't know how to do it in QM. Maybe Google will help.


Forum Jump:


Users browsing this thread: 1 Guest(s)