Comments (8)
Sorry, for issues in this library, I'm doing some structure changes in my local repo and would be releasing soon.
Again sorry for the issues.... I'm trying my best to keep this project alive while searching for the jobs.
Thanks for understanding.
Much appreciated.
from excel.
_updateCell(sheetName, foundRow, columnIndex, rowIndex, data.value,
data.cellStyle?.numberFormat);
main point of error is from here. If we do not specify the cellStyle it gives format null error and thows exception .
I got this error from sheetObject.insertRowIterables() where I can't set any cellstyle
If you got problem from same method you can use this fork
excel:
git:
url: "https://github.com/innovatoraakash/excel"
Giving a default format on this will be productive and easier for everyone.
from excel.
I met the same question when using save method to save excel, This is my code:
var excel = Excel.createExcel();
Sheet sheetObject = excel['Sheet1'];
sheetObject.appendRow([
const TextCellValue('Date'),
const TextCellValue('Amount'),
const TextCellValue('Type'),
const TextCellValue('Kind'),
const TextCellValue('Description')
]);
var billings = await GetIt.I<BillingRepository>().billings();
for (var billing in billings) {
developer.log('message, ${DateTimeCellValue.fromDateTime(billing.date)}');
sheetObject.appendRow([
DateTimeCellValue.fromDateTime(billing.date),
DoubleCellValue(billing.amount.toDouble()),
TextCellValue(billing.type == BillingType.expense ? 'COST' : 'INCOME'),
TextCellValue(billing.kind.name),
TextCellValue(billing.description)
]);
}
var fileBytes = excel.save();
For appendRow method, it works fine. But when I invoke save() method, it will throw exception like this:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: null does not work for DateTimeCellValue
#0 Save._createCell (package:excel/src/save/save_file.dart:142:16)
#1 Save._updateCell (package:excel/src/save/save_file.dart:997:16)
#2 Save._setRows (package:excel/src/save/save_file.dart:652:9)
#3 Save._setSheetElements. (package:excel/src/save/save_file.dart:966:7)
#4 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:633:13)
#5 Save._setSheetElements (package:excel/src/save/save_file.dart:914:22)
#6 Save._save (package:excel/src/save/save_file.dart:544:5)
#7 Excel.save (package:excel/src/excel.dart:348:21)
It looks like I can not use DateTimeCellValue
and DoubleCellValue
. If I use TextCellValue
, it will not throw exceptions.
@AbhiralJain
from excel.
I am getting the same error on DateCellValue, IntCellValue, DoubleCellValue. No matter how i try to implement it.
Something seems to be going wrong in .save() method.
Any soultion to this? Also setColumnWIdth() & setRowHeight() dosent seem to work anymore
from excel.
@Epiwish Hi, If you want to update cell using DateTimeCell value, you need to provide the format using numberFormat parameter in cellStyle.
Here is an example:
sheetObject.updateCell(
CellIndex.indexByString('C$i'),
DateTimeCellValue(
year: 1,
month: 1,
day: 1,
hour: 1,
minute: 1,
second: 1,
),
cellStyle: CellStyle(
numberFormat: NumFormat.defaultDate,
),
);
from excel.
@Epiwish Hi, If you want to update cell using DateTimeCell value, you need to provide the format using numberFormat parameter in cellStyle.
Here is an example: sheetObject.updateCell( CellIndex.indexByString('C$i'), DateTimeCellValue( year: 1, month: 1, day: 1, hour: 1, minute: 1, second: 1, ), cellStyle: CellStyle( numberFormat: NumFormat.defaultDate, ), );
How can I set cellStyle when using excel.save()?
I'm just trying to create a new excel file with some DateTimeCellValues
from excel.
I also get the same error when using excel.save(). Is there any workaround in the meantime?
from excel.
_updateCell(sheetName, foundRow, columnIndex, rowIndex, data.value, data.cellStyle?.numberFormat);
main point of error is from here. If we do not specify the cellStyle it gives format null error and thows exception . I got this error from sheetObject.insertRowIterables() where I can't set any cellstyle If you got problem from same method you can use this fork
excel: git: url: "https://github.com/innovatoraakash/excel"
Giving a default format on this will be productive and easier for everyone.
your update work only for int vaule , but I got error when used datetime, so i eventually used text for my datetime.
from excel.
Related Issues (20)
- How to use custom Chinese fonts
- Excel - Roadmap Tasks HOT 2
- Default constructors for simplicity
- rename sheet breaks with archive 3.4.10 HOT 1
- Excel.decodeBytes -> Bad State too many elements
- The argument type 'String' can't be assigned to the parameter type 'ExcelColor' HOT 4
- How to parse Excel cell merging information?
- Bug reading SpannedItems as empty HOT 2
- README.md demo doesn't compile since 4.0.3 update
- Couldn't decode ".xls" file HOT 1
- Cannot delete sheets HOT 6
- DateTimeCellValue not working on Windows
- Very inefficient RAM usage HOT 2
- Can't read the XLSX file from http request - Damaged Excel file: Corrupted Excel file HOT 1
- How to save .csv
- Bad state: No element while parsing
- Can I select the sheet I want to open in a file that has multiple sheets?
- update package HOT 5
- Cells with a time below `02:25:00` are recognized as `DateTimeCellValue` HOT 1
- BoolCellValue not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excel.