rabanti-github / picoxlsx Goto Github PK
View Code? Open in Web Editor NEWPicoXLSX is a small .NET / C# library to create XLSX files (Microsoft Excel 2007 or newer) in an easy and native way
License: MIT License
PicoXLSX is a small .NET / C# library to create XLSX files (Microsoft Excel 2007 or newer) in an easy and native way
License: MIT License
Hello,
Appreciate the library. I'm having an issue and I'm not sure if its just my lack of understanding or if its perhaps a bug.
When I run the following code (hand typed here, so ignore syntactical errors) I would have expected that my row of data to have a gray background except for the cell in column 2 having a red background.
workbook.CurrentWorksheet.AddCellRange(data, new Cell.Address(0, idx), new Cell.Address(data.Count - 1, idx), Style.BasicStyles.ColorizedBackground("a6a1a1"));
workbook.CurrentWorksheet.GetCell(2, idx).SetStyle(Style.BasicStyles.ColorizedBackground("bf6262"));
It currently changes the style for the whole row to have the red background.
I though perhaps it was the fact that I was adding a range of data instead of a single cell at a time so I tried this as well, with the same result:
data.ForEach(p=> workbook.CurrentWorksheet.AddNextCell(p, Style.BasicStyles.ColorizedBackground("a6a1a1")));
workbook.CurrentWorksheet.GetCell(2, 0).SetStyle(Style.BasicStyles.ColorizedBackground("bf6262"));
Would you expect it to change the style of the whole row or am I doing something wrong?
I`d like to write cell notes in a spreadsheet.
Is it supported? If not, could you point me to how to add this support? I could do a PR.
Hello,
It looks like merged cell style keeps borders only for top-left cell, does not matter in which order value, style and merge happened:
var style = new Style();
style.CurrentBorder.RightStyle = Style.Border.StyleValue.medium;
var wb = new Workbook(true);
var sh = wb.CurrentWorksheet;
int xy = 1;
// Value, Merge, Style
sh.AddCell("V,M,S", xy, xy);
sh.MergeCells(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1));
sh.SetStyle(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1), style);
xy = 3;
// Value, Style, Merge
sh.AddCell("V,S,M", xy, xy);
sh.SetStyle(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1), style);
sh.MergeCells(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1));
xy = 5;
// no Value, Style, Merge
sh.SetStyle(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1), style);
sh.MergeCells(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1));
xy = 7;
// no Value, Merge, Style
sh.MergeCells(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1));
sh.SetStyle(new Cell.Address(xy, xy), new Cell.Address(xy, xy + 1), style);
wb.SaveAs("c:\\temp\\merge.xlsx");`
I was also trying to assign style only to left-top corder before merge in hope that it will be applied to the whole merged cell - no luck as well.
Is it a bug or this needs to be written in some other way?
Hi,
I'm missing some features.
Perhaps you can put them on the roadmap.
Thanks
hi
System date format for the date of Taipei (106/03/05), the data stored in the wrong
date format date (2017/03/05) is OK
can you help me.
good job !!
new version, get it ,thanks.
How to define cell style to datetime format "dd.mm.yyyy hh:mm" ?
Thanks for answer.
The value type is always "guessed" in the base Cell constructor, overriding what the user chooses.
Fixed in #6.
Please delete me. I created it wrongly here where it belongs to NanoXLSX
Hi,
How do you define a cell style custom format for a date ? I wanted to make the cell style for a date as yyyy.mm.dd
Regards,
Hey,
I'm entertaining using this. Based on the documentation it seems like this tool is intended to write to disk only. Can I use this to simply iterate and read spreadsheet rows?
I'm avoiding the interlop assemblies for such a simple task.
Hi,
Do you have a Plan to read excel file?
like this
https://github.com/shps951023/MiniExcel
When generating files, RichTextString is not supported, similar to Excel's Cell.Characters
When using the SaveAsStream Method the Stream is closed. This is mostly ok with a FileStream, but with a MemoryStream you can't read the Stream into something else that accepts a Stream. The Demo's say you can use a MemoryStream, but I'm not sure how you could ever do that. I am using this to create an XLSX from a DataTable and then archive it into a document repo via its API. Since the MemoryStream is closed I can't archive it directly from the Stream. I have to use a FileStream or Save the file which does the same thing. Then read the saved file to archive it. It works with the work around so it isn't critical, but figured I was log it as an issue since the Demo says MemoryStreams are supported. Thanks.
MemoryStream.CanWrite evaluates to false after calling the SaveAsStream method.
Hi, when merging several cells, for which the first has an applied style, the merged cell doesn't have any style applied.
The method «ResolveMergedCells» always replace the style of ALL CELLS by the MergeCellStyle (which is empty).
if (pos != 0)
{
cell.DataType = Cell.CellType.EMPTY;
}
cell.SetStyle(mergeStyle);
To preserve the style of the first cell, it should be:
if (pos != 0)
{
cell.DataType = Cell.CellType.EMPTY;
cell.SetStyle(mergeStyle);
}
Fixed in #4
This can be verified by running demo4.
Is it possible to change tab color? I was looking for something like this worksheet.TabColor but didn't found.
Hi,
I'm come in , again~
See title,thank you for your help~
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.