ObjectSize Class
- Namespace
TXTextControl.TXSheetControl. Server
- Package
TXTextControl.from the private NuGet feed or the supplied NuGet folderTXSheetControl. Server
- Assembly
TXTextControl.TXSheetControl. Api. dll
- Install
dotnet add package TXTextControl..NET 10 and later.TXSheetControl. Server
- Also in
TXTextControl.asTXSheetControl. Blazor TXTextControl.TXSheetControl. Api. dll
- Implements
- IEquatable<Object
Size>
Unscaled drawing dimensions in CSS pixels, independent of editor zoom.
Syntax
public class ObjectSize
Interfaces: IEquatable<ObjectSize>.
Members
Constructors
| Constructor | Description |
|---|---|
| Constructor |
Properties
Examples
Apply ObjectSize to a small working document, then return the exported bytes. The caller can save or download the result.
using TXTextControl.TXSheetControl.Server;
async Task<byte[]> CreateObjectSizeReportAsync(ServerSheetControl control)
{
var book = control.Workbook;
var sheet = await book.Sheets.AtAsync(0);
await sheet.Range("A1:B5").SetValuesAsync(new object?[][]
{
[], ["North", 42000], ["South", 38500], ["East", 31200], ["West", 44900]
});
var chart = await sheet.Charts.AddAsync(new { type = "column", title = "Revenue by region", dataRange = "A1:B5", anchor = new { cell = "D2" } });
var settings = new ObjectSize(480, 240);
await chart.ResizeAsync(settings);
return await control.SaveAsync(StreamType.PDF);
}