I wanted to see if you can populate a range all at once from an array when using closedXML instead of populating a single cell at a time. Also, if it is possible to set a range from an array, would that be faster than looping through cell by cell and populating each cell?
You can try to insert data as a DataTable and see if it will speed up document creation. But as I can see in source code, there is no optimisation possible whatsoever against single cell population (but I can be wrong).
You can do:
cell.Value = yourArray;
See the section "Inserting Data/Tables" of the Documentation.
Related
I am using Aspose. Cell for .net to write some data into Excel. I have a quick question:
what are the best practices to get and write a value into the below cell?
this kind of cell may be across multiple columns/rows, does it belong to Rang or a special cell?
thanks
If it is merged cell, then you should use Cell object (you may use its PutValue method to insert data). Please note, in MS Excel sheet, when you merge a range of cells, the merged cell’s name will be top left cell,
so it will be accessed by that name. For example, when you merge "B1:F3" cells, it will become one big cell (B1). Now you got to access and insert data into B1 cell if you want to insert some data into that merged area range.
PS. I am working as Support developer/ Evangelist at Aspose.
enter image description here
I would like to find all "NC2" mathces in this worksheet (later the B column values).
I tried with range.find but I got back only one result.
How can I read out these cells? (Which contains NC2)
what I would do is do a data -> filter to get all the cells.
if it helps, conditional formatting would also help to visually find all the cells containing NC2.
I have a list view in WinForms that works and looks fine. However, the grid lines are formatted in such a way that there's no separation between the column headers and the first row of data. This makes it look like the first row of data is part of the column headers. You can see what I mean here:
Is there any way I can format the list to stop this from happening, and make it look 'proper'? Thanks for any help.
I see you're displaying "data" to users in a grid - except you're using a ListView - which is really intended for filesystem display, not data.
I recommend you switch to using DataGridView (avoid System.Windows.Forms.DataGrid as it's older and doesn't let you (easily) control the data being displayed).
Also, protip for usability: if a table cell contains numeric data then it should be formatted with Right alignment, otherwise give it a Left alignment - avoid Middle/Center alignment in non-header table cells as it makes it difficult to visually scan a table.
I want to convert the data of Excel file in the DataTable for edit. But cells with formulas should not be editable. How do I find that the cell contains a formula, if I get the calculated value in it? Thanks.
Try the .HasFormula property of Range
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.range.hasformula.aspx
Range.SpecialCellsmethod enables to get cells with constant values or formulas.
I have a DataGridView (DGV) object which is populated by a method which dynamically adjusts the number of columns and takes column header information from the first row of data. I have no choice but to set the column names AFTER the DGV object has been populated (the column names can also change depending on the data they contain).
However, occasionally the source data contains dates. I know the cell format can be set at the time of creation but for me this assumes I know the number of columns and type of data in advance. So my question is, is it possible to set the data type property for a specific cell to DateTime AFTER all the data has been populated and have this actually take effect so that I can actually sort by date? I tried it, but the data is still treated as text and sorting takes place based on the alphabet (not date).
I've seen various examples where it is done at source and in an ideal world I would re-write my method to accommodate this requirement, but I'm an amateur and looking for a quick win :)
Anybody?
Thanks