简体   繁体   中英

How do you remove delimiters of a cell/column in EPPLUS?

I am working with a dataset that has a "tab" delimiter at the end of the cells. This ruins my conversion of the cells to become a date format.

I know you can remove the delimiters manually by going to Data -> Text to Columns and then unchecking all delimiters, but how would I do this programmatically using EPPLUS?

Any help is appreciated, thanks!

I have learned that Excel saw these values as strings and not as DateTime.

I had to convert the cells into a DateTime value so that the formatting can apply correctly:

for (int row1 = rowDetailStart + 1; row1 <= rowDetailEnd; row1++){
            invoiceDetailSheet.Cells[row1, 16, row1, 16].Style.Numberformat.Format = "m/d/yyyy";
            invoiceDetailSheet.Cells[row1, 16, row1, 16].Value = DateTime.Parse(invoiceDetailSheet.Cells[row1, 16, row1, 16].Text);
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM