私は adz コレクターを作成しているので、ウェブサイトから広告を取得し、html を取得してタイトル、価格、説明を取得します。最後に DataTable に入力し続け、DataTable を CSV にエクスポートします。しかし、問題はテキストです。コードでは問題ありませんが、CSV にエクスポートすると次のようになります。
· 75% of the Controller’s time will focus on accounting: Their role includes: o
Bookkeeping o Payroll o Monthly HST o Trust accounting; Ensuring compliance with the Real
Estate Council requirements o Financial Statement Preparation · 25% Will be management
functions: o Supervise and assist with conveyancing o Supervise all the office staff (4 -
6) o Other day to day management functions. Requirements and Qualifications Essential
Skills · Experience working with government regulated financial reporting · Experience
working with large numbers of people in a customer service oriented role · Experience with
Trust Accounting Additional Assets ....
どこにでもシンボルがあります。エクスポートに使用するコードは次のとおりです。
public void DataTable2CSV(DataTable table, string filename, string seperateChar)
{
StreamWriter sr = null;
try
{
sr = new StreamWriter(filename, true);
string seperator = "";
StringBuilder builder = new StringBuilder();
foreach (DataColumn col in table.Columns)
{
builder.Append(seperator).Append(col.ColumnName);
seperator = seperateChar;
}
sr.WriteLine(builder.ToString());
foreach (DataRow row in table.Rows)
{
seperator = "";
builder = new StringBuilder();
foreach (DataColumn col in table.Columns)
{
builder.Append(seperator).Append(row[col.ColumnName]);
seperator = seperateChar;
}
sr.WriteLine(builder.ToString());
}
}
finally
{
if (sr != null)
{
sr.Close();
}
}
}