FillFormat Class
Represents a base class for fills such as solid, gradient, pattern, etc.
- Inheritance:
- System.ObjectFillFormat
- Derived
Properties
FillType
Gets the type of the fill.
public abstract FillFormatType FillType { get; }
Public MustOverride ReadOnly Property FillType As FillFormatType
Property Value
The type of the fill.
Methods
SetNone()
Sets the fill to none, thus making the area transparent.
Returns
An instance of a FillFormat type that represents no fill that was set.
SetPattern(PatternFillType, DrawingColor, DrawingColor)
Sets the fill to the pattern fill.
public PatternFillFormat SetPattern(PatternFillType patternType, DrawingColor foregroundColor, DrawingColor backgroundColor)
Public Function SetPattern(patternType As PatternFillType, foregroundColor As DrawingColor, backgroundColor As DrawingColor) As PatternFillFormat
Parameters
patternType
- PatternFillType
Type of the pattern fill.
foregroundColor
- DrawingColor
Foreground color of the pattern fill.
backgroundColor
- DrawingColor
Background color of the pattern fill.
Returns
An instance of a PatternFillFormat type that was set.
SetPicture(Content)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(Content content)
Public Function SetPicture(content As Content) As PictureFillFormat
Parameters
content
- Content
Content of the picture source.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload if multiple PictureFillFormats should share the same picture source.
Exceptions
- System.ArgumentNullException
content
is null.
SetPicture(Stream)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(Stream stream)
Public Function SetPicture(stream As Stream) As PictureFillFormat
Parameters
stream
- System.IO.Stream
Stream containing the picture source.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload to automatically detect the picture content type from the decoded picture stream
.
Exceptions
- System.ArgumentNullException
stream
is null.
- System.ArgumentException
Picture stream
encoding format is not supported.
SetPicture(Stream, PictureContentType)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(Stream stream, PictureContentType contentType)
Public Function SetPicture(stream As Stream, contentType As PictureContentType) As PictureFillFormat
Parameters
stream
- System.IO.Stream
Stream containing the picture source.
contentType
- PictureContentType
Content type of the picture source.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload to explicitly specify picture content type so that the picture stream
doesn't have to be decoded to detect the picture content type.
Exceptions
- System.ArgumentNullException
stream
is null.
SetPicture(Stream, String)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(Stream stream, string contentType)
Public Function SetPicture(stream As Stream, contentType As String) As PictureFillFormat
Parameters
stream
- System.IO.Stream
Stream containing the picture source.
contentType
- System.String
Content type (MIME type) of the picture source.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload to explicitly specify picture content type that is not supported by the PictureContentType.
Exceptions
- System.ArgumentNullException
stream
is null.
- System.ArgumentException
contentType
is null or System.String.Empty.
SetPicture(String, PictureContentType)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(string picturePath, PictureContentType contentType)
Public Function SetPicture(picturePath As String, contentType As PictureContentType) As PictureFillFormat
Parameters
picturePath
- System.String
Path to a picture source.
contentType
- PictureContentType
Content type of the picture source.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload to explicitly specify picture content type (for example, if picturePath
doesn't specify a file extension).
Exceptions
- System.ArgumentException
picturePath
is null or System.String.Empty.
SetPicture(String, Boolean)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(string picturePath, bool isLink = false)
Public Function SetPicture(picturePath As String, isLink As Boolean = False) As PictureFillFormat
Parameters
picturePath
- System.String
Path or link to a picture source.
isLink
- System.Boolean
true if the picture is linked to the file in which ExcelFile instance is saved; otherwise, false.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload to automatically detect the picture content type from the picturePath
extension.
Parameter picturePath
must contain supported extension (for example, ".png") if isLink
is false, otherwise exception is thrown.
Exceptions
- System.ArgumentException
picturePath
is null or System.String.Empty or picturePath
doesn't contain extension or extension is not supported.
SetPicture(String, String)
Sets the fill to the picture fill.
This method is not applicable on Fill property.
public PictureFillFormat SetPicture(string picturePath, string contentType)
Public Function SetPicture(picturePath As String, contentType As String) As PictureFillFormat
Parameters
picturePath
- System.String
Path to a picture source.
contentType
- System.String
Content type (MIME type) of the picture source.
Returns
An instance of a PictureFillFormat type that was set and can be used to set tiling or stretch options of the picture fill.
Remarks
Use this overload to explicitly specify picture content type that is not supported by the PictureContentType.
Exceptions
- System.ArgumentException
picturePath
or contentType
is null or System.String.Empty.
SetSolid(DrawingColor)
Sets the fill to the solid fill.
public SolidFillFormat SetSolid(DrawingColor color)
Public Function SetSolid(color As DrawingColor) As SolidFillFormat
Parameters
color
- DrawingColor
The color of the solid fill.
Returns
An instance of a SolidFillFormat type that was set.