Show code in...     

  

 

Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


The Picture Object (SAPicture)

* The Picture object is not available in ExcelWriterSE, ExcelWriterLE, or ExcelWriterFree.

The Picture object represents a single picture in a spreadsheet. To create a Picture object, use Pictures.CreateFromFile2 or Pictures.CreateFromFile.

Picture Methods and Properties

*This feature is not available in ExcelWriterSE, ExcelWriterLE, or ExcelWriterFree.

Picture Methods and Properties
AreaPattern*

Sets or retrieves the background pattern of a transparent, or partly transparent, picture. ExcelWriter supports nineteen patterns, listed in the table below.

No Pattern0
0% Pattern1
50% Pattern2
70% Pattern3
25% Pattern4
Dark Horizontal5
Dark Vertical6
Dashed Downward Diagonal7
Dashed Upward Diagonal8
Small Checkerboard9
Trellis10
Light Horizontal11
Light Vertical12
Wide Downward diagonal13
Dark Upward diagonal14
Small Grid15
60% Pattern16
20% Pattern17
10% Pattern18

[VBScript]
Property AreaPattern As ASXAreaPatternType (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Set the area patter of the picture to Light Vertical
Pic.AreaPattern = saxlsLightVerticalPattern


Top

BorderLineType*

Sets or retrieves the borderline type of a picture. ExcelWriter supports nine BorderLineTypes, listed in the following table.

Solid0
Dash1
Dot2
Dash-Dot3
Dash-Dot-Dot4
Dark Gray5
Medium Gray6
Light Gray8

[VBScript]
Property BorderLineType As ASXLineStyle (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Set the border line type to dash-dot-dot
Pic.BorderLineType = saxlsDash_Dot_Dot


Top

BorderWeight*

Sets or retrieves the weight of the border line of a picture. BorderWeight has four possible values, listed in the following table.

HairLine0
SingleLine1
MediumLine2
WideLine3

The following example sets BorderWeight to WideLine.


[VBScript]
Property BorderWeight As ASXLineWeight (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Set the weight of the picture's border to "medium line"
Pic.BorderWeight = saxlsMediumLine 


Top

HasShadow*

When set to True, displays a picture with a shadow effect. HasShadow is False by default.


[VBScript]
Property HasShadow As Boolean (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Show the picture with a shadow effect (False by default)
Pic.HasShadow = True


Top

LowerDeltaX*

Specifies the picture's horizontal offset from its lower right corner column. If the LowerDeltaX value is negative, the picture's right border will be offset to the left. If the LowerDeltaX value is positive, the picture's right border will be offset to the right.


[VBScript]
Property LowerDeltaX As Long (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- The following example will display the picture offset 
'--- to the right of its right-border column. 
Pic.LowerDeltaX = 200


Top

LowerDeltaY*

Specifies the picture's vertical offset from its lower right corner row. If the LowerDeltaY value is negative, the picture's bottom border will be offset upward. If the LowerDeltaY value is positive, the picture's bottom border will be offset downward.


[VBScript]
Property LowerDeltaY As Long (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- The following example will display the picture 
'--- offset upward of its bottom row
Pic.LowerDeltaY = -200


Top

LowerRightColumn*

Returns the lower right column position of an inserted picture. You can use this property in conjunction with LowerDeltaX to correctly position text around an inserted image.


[VBScript]
Property LowerRightColumn As Long (read-only)

		

Example:



[VBScript]
set xlw = createobject("SoftArtisans.ExcelWriter")
set ws = xlw.worksheets(1)
Set pic = ws.Pictures.CreateFromFile2(2,2,"C:\WINNT\WEB\Wallpaper\Boiling Point.jpg")
...                    
LowerRightCol = pic.LowerRightColumn
...

Top

LowerRightRow*

Returns the lower right row position of an inserted picture. You can use this property in conjunction with LowerDeltaY to correctly position text around an inserted image.


[VBScript]
Property LowerRightRow As Long (read-only)

		

Example:



[VBScript]
set xlw = createobject("SoftArtisans.ExcelWriter")
set ws = xlw.worksheets(1)
Set pic = ws.Pictures.CreateFromFile2(2,2,"C:\WINNT\WEB\Wallpaper\Boiling Point.jpg")
...                    
LowerRightRow = pic.LowerRightRow
...

Top

Move*

Moves the picture to a specified location. Move takes four parameters that determine the new position of the picture in the worksheet:


[VBScript]
Sub Move(UpperLeftColumn As Long, _
UpperLeftRow As Long, _
LowerRightColumn As Long, _
LowerRightRow As Long)

	

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Re-position your picture at upper-left corner J9 
'--- and lower-right corner V16
Pic.Move 10, 9, 22 16


Top

UpperDeltaX*

Specifies the picture's horizontal offset from its upper left corner column. If the UpperDeltaX value is negative, the picture's left border will be offset to the left. If the UpperDeltaX value is positive, the picture's left border will be offset to the right.


[VBScript]
Property UpperDeltaX As Long (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Display the picture offset to the right 
'--- of its left-border column
Pic.UpperDeltaX = 200


Top

UpperDeltaY*

Specifies the picture's vertical offset from its upper left corner row. If the UpperDeltaY value is negative, the picture's top border will be offset upward. If the UpperDeltaY value is positive, the picture's top border will be offset downward.

The following example will display the picture offset downward of its upper row.


[VBScript]
Property UpperDeltaY As Long (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference to worksheet #1
Dim XlwApp, WrkSht, Pic
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Add a picture to the worksheet at A1
Set Pic = WrkSht.Pictures.CreateFromFile2(1,1,"c:\temp\pic.bmp")

'--- Display the picture offset downward of its upper row
Pic.UpperDeltaY = 200


Top

UpperLeftColumn*

Returns the upper left column position of an inserted picture. You can use this property in conjunction with UpperDeltaX to correctly position text around an inserted image.


[VBScript]
Property UpperLeftColumn As Long (read only)

		

Example:



[VBScript]
set xlw = createobject("SoftArtisans.ExcelWriter")
set ws = xlw.worksheets(1)
Set pic = ws.Pictures.CreateFromFile2(2,2,"C:\WINNT\WEB\Wallpaper\Boiling Point.jpg")
...                    
UpperLeftCol = pic.UpperLeftColumn
...

Top

UpperLeftRow*

Returns the upper left row position of an inserted picture. You can use this property in conjunction with UpperDeltaY to correctly position text around an inserted image.


[VBScript]
Property UpperLeftRow As Long (read only)

		

Example:



[VBScript]
set xlw = createobject("SoftArtisans.ExcelWriter")
set ws = xlw.worksheets(1)
Set pic = ws.Pictures.CreateFromFile2(2,2,"C:\WINNT\WEB\Wallpaper\Boiling Point.jpg")
...                    
UpperLeftRow = pic.UpperLeftRow
...

Top

*This feature is not available in ExcelWriterSE, ExcelWriterLE, or ExcelWriterFree.


Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


Copyright © 2005, SoftArtisans, Inc.