简体   繁体   中英

Working with a multi-line Excel Cell into a C# Program

My problem seems to be a simple case, but I can't seem to find any answers on it. I'm trying to write a program that will allow me to read Excel files using C# and the Interop method. These Excel files can contain information that has been entered with the use of "Alt-Enter" to create multiple lines within the cell, each line denoting a different value.

Currently my program spits out the contents of the whole cell, but how do I separate out the multiple values in the single cell, so that I am able to work on the individual values? Sorry if this has a simple answer, I'm a noob at this!

你可以使用String.Split函数:

string[] values = ((string) multiLineCell.Value).Split('\n');

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