【发布时间】:2015-08-13 03:22:39
【问题描述】:
我正在尝试阅读 200 页的 pdf 文件。数据采用类似 excel 的格式,我想将每一行添加到列表中。
我目前拥有的 for 循环只会存储当前页面中的行。
string[] words2 = null;
string CurrentPage = " ";
for (int page = 1; page <= reader.NumberOfPages; page++)
{
CurrentPage = PdfTextExtractor.GetTextFromPage(reader, page);
//here split the all data of the page in the form of line and store in the string array
words2 = CurrentPage.Split('\n');
words2.ToList();
}
如何将 10,000 行文本添加到同一个列表中?
【问题讨论】:
-
在调用
words2.ToList()之后,你需要将它分配给一些东西。
标签: c# list pdf for-loop file-io