PictureSource.FromBytes Method
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.asTXSheetControl. Server TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Api. dll
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
Creates or updates a document-bound handle or queued operation; the owning workbook retains validation authority.
Syntax
public static PictureSource FromBytes(byte[] bytes, string? mimeType = null, string? altText = null)
Parameters
| Parameter | Type | Optional | Description |
|---|---|---|---|
bytes | byte[] | No | Input workbook bytes owned by the caller. |
mimeType | string? | Yes | Operation-specific input; see this type's units and ownership contract. |
altText | string? | Yes | Operation-specific input; see this type's units and ownership contract. |
Return Value
PictureSource. The operation result, returned asynchronously.
Examples
Create a working document workflow using PictureSource. Return the generated document or application data to the caller.
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> BuildPictureSourceFromBytesAsync(ServerSheetControl control, byte[] logoPng)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
var logo = PictureSource.FromBytes(logoPng, "image/png", "Alpine Design logo");
await sheet.Drawings.AddPictureAsync(new { source = logo, anchor = new { cell = "A1" }, size = new { width = 160, height = 60 } });
return await control.SaveAsync(StreamType.PDF);
}
Remarks
Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.