Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/syncfusion_flutter_xlsio/lib/src/xlsio/general/enums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1444,3 +1444,20 @@ enum _ActivePane {
/// value specifies the right pane.
topRight
}

/// Enum defining different editing modes for an object within a cell-based system.
enum PictureResizeMode {
/// In this mode, when you resize the cell, the Image remains the same size,
/// and only the cell's dimensions are adjusted.
moveButDontSizeWithCell('oneCell'),

/// In this mode, when you resize the cell, the Image's size is adjusted to
/// match the new cell dimensions.
moveAndSizeWithCell('twoCell');

/// The underlying string value for each enum value.
final String value;

/// Constructor to initialize the enum with a string value.
const PictureResizeMode(this.value);
}
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,7 @@ class SerializeWorkbook {
}
imgId++;
builder.element('xdr:twoCellAnchor', nest: () {
builder.attribute('editAs', 'twoCell');
builder.attribute('editAs', picture.resizeMode.value);
builder.element('xdr:from', nest: () {
builder.element('xdr:col', nest: picture.column - 1);
builder.element('xdr:colOff', nest: 0);
Expand Down Expand Up @@ -1967,7 +1967,7 @@ class SerializeWorkbook {
}
imgId++;
builder.element('xdr:twoCellAnchor', nest: () async {
builder.attribute('editAs', 'twoCell');
builder.attribute('editAs', picture.resizeMode.value);
builder.element('xdr:from', nest: () async {
builder.element('xdr:col', nest: picture.column - 1);
builder.element('xdr:colOff', nest: 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@ class Picture {
static const List<int> _jpegSignature = <int>[255, 216];
static const List<int> _pngSignature = <int>[137, 80, 78, 71, 13, 10, 26, 10];

/// The image mode depends on changes to cells when modified."
///
/// Example:
/// ```dart
/// Workbook workbook = new Workbook();
/// Worksheet sheet = workbook.worksheets[0];
/// List<int> bytes = File('image.png').readAsBytesSync();
/// Picture picture = sheet.picutes.addStream(1, 1, bytes);
/// picture.resizeMode = PictureResizeMode.moveAndSizeWithCell;
/// List<int> bytes = workbook.saveAsStream();
/// File('Picutes.xlsx').writeAsBytes(bytes);
/// workbook.dispose();
/// ```
PictureResizeMode resizeMode = PictureResizeMode.moveAndSizeWithCell;

/// Gets/Sets the image data.
List<int>? _imageData;

Expand Down
2 changes: 0 additions & 2 deletions packages/syncfusion_flutter_xlsio/lib/xlsio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import 'package:intl/number_symbols_data.dart';
import 'package:jiffy/jiffy.dart';
import 'package:syncfusion_officecore/officecore.dart';
import 'package:xml/xml.dart';

part 'src/test/images.dart';
part 'src/xlsio/autoFilters/auto_filter.dart';
part 'src/xlsio/autoFilters/autofilter_impl.dart';
part 'src/xlsio/autoFilters/autofiltercollection.dart';
Expand Down