Comments (5)
Hi @MartinGreen,
I tested with similar code and it seems to work with the latest commit. Does the code below work for you on v1.33.0?
[Fact]
public void Issue632_1()
{
//https://github.com/mini-software/MiniExcel/issues/632
var values = new List<Dictionary<string, object>>();
foreach ( var item in Enumerable.Range( 1, 100 ) ) {
var dict = new Dictionary<string, object>
{
{ "Id", item },
{ "Time", DateTime.Now.ToLocalTime() },
{ "CPU Usage (%)", Math.Round( 56.345, 1 ) },
{ "Memory Usage (%)", Math.Round( 98.234, 1 ) },
{ "Disk Usage (%)", Math.Round( 32.456, 1 ) },
{ "CPU Temperature (°C)", Math.Round( 74.234, 1 ) },
{ "Voltage (V)", Math.Round( 6.3223, 1 ) },
{ "Network Usage (Kb/s)", Math.Round( 4503.23422, 1 ) },
{ "Instrument", "QT800050" }
};
values.Add( dict );
}
var config = new OpenXmlConfiguration
{
TableStyles = TableStyles.None,
DynamicColumns = new DynamicExcelColumn[]
{
new DynamicExcelColumn("Time") { Index = 0, Width = 20, Format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern + " " + CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern },
}
};
var path = Path.Combine(
Path.GetTempPath(),
string.Concat( nameof( MiniExcelIssueTests ), "_", nameof( Issue632_1 ), ".xlsx" )
);
MiniExcel.SaveAs( path, values, excelType: ExcelType.XLSX, configuration: config, overwriteFile: true );
}```
from miniexcel.
Hi @meld-cp
I tested your example and it does fail to produce a valid file for me. However, I was able to narrow it down further.
If I remove the Format
value from the config it will create a valid file.
var config = new OpenXmlConfiguration
{
TableStyles = TableStyles.None,
DynamicColumns = new DynamicExcelColumn[]
{
new DynamicExcelColumn("Time") { Index = 0, Width = 20, /*Format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern*/ },
}
};
The moment I add Format it fails again, even with a simpler value than I was originally using. I also tried InvariantCulture
with the same result.
I also tested this with 1.34 and its the same behaviour.
Thanks.
from miniexcel.
@MartinGreen interesting 🤔
Does changing the style to: TableStyles = TableStyles.Default,
work by chance?
from miniexcel.
@meld-cp
Yeah changing the TableStyles fixes it!
from miniexcel.
Nice!... so the None
style is broken/out of date... working on a fix 🤞
from miniexcel.
Related Issues (20)
- 多Sheet XLSX文件,MiniExcel读取数据时间过长 HOT 3
- [question] 1) how can i add a row above the table add some text in it. ? 2) and merge the cells a1 to g1 ? HOT 1
- 枚举描述,如果数据没有在枚举里面则会报错
- How to Create an Excel Template and Fill Data Horizontally with MiniExcel
- Freeze top row
- 通过模板引擎(IIncrementalGenerator)生成excel的一些建议 HOT 1
- long类型的字段无法正常设置为文本 HOT 2
- 空白模板导出 HOT 3
- M HOT 1
- How to trigger Excel's automatic calculation before saving HOT 4
- 想请教下有没有类似像easyexcel的那个自定义convert的功能?
- 新增公开的最大行与列属性
- MiniExcel.Insert()方法无法正常追加CSV文件 HOT 1
- 填充模板是否可以增加对sheet栏的命名
- 使用Memorystream进行Excel反序列化抛出异常
- feat: 内置一个 IDataReader 类简化自定义使用流式导出逻辑 HOT 2
- feat: 能否增加一个冻结首行功能
- CSV 单纯含有空格 没必要在在首尾添加引号
- JsonObject as data source
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 miniexcel.