excel内の指定文字列をforeachでrow,column両方向に検索し、
文字列があればそれを置き換える方法を探しています。
Search the specified character string in excel in both row and column with foreach,
I want to know how to replace it if there is a string.
しかし、ReadCell とwriteCellのRange指定で引っかかってしまいます。
指定方法は下記リンク先を参考に作成しましたが、英語が苦手でよく読み込めていないです。
but, it will be stuck with the Range specification of ReadCell and writeCell.
I made it by referring to the following link destination, but I am poor at English and I can not read it well. How to Write to Excel CELL index v.2
下記にサンプルをアップロードしましたので、
原因を教えていただけないでしょうか?
Since I uploaded the sample below,
Could you tell me the cause? replace.xaml (19.4 KB)
ありがとうございます!
アドバイス助かりました。
Thank!
Your advice was helpful.
For each rowを使用して目標の動作が行えました。
I was able to do the goal using the For each row activity.
Replaceですが、私の目的は変数tmpを置換ではなく
検索先セルの文字列を置換ですので、
教えていただいた方法は違うものだったようです。
認識間違っていたらごめんなさい。
For Replace, my purpose is to replace the variable tmp with the string of the destination cell instead of replacing it, so it seems that the method I taught was different.
Sorry if my perception was wrong.
回答ありがとう!
日本語で返信もらえると、とても助かります。
Thanks for answering!
It is very helpful if you reply in Japanese.
教えて貰ったやり方で作成してみたのですが
WriteRangeで出力したDataTableが置換前のままなのです。
I tried to create it in the way I taught you
The DataTable output by WriteRange remains as it was before replacement.
どこを直せばよいのでしょうか?
ダウンロードフォルダに、この返信へ添付したexcelファイルを置いて実行しています。
Where should I fix it?
I place the excel file attached to this reply in the download folder and it is executed.
For each column in DATATABLE.Columns:
Assign → row(column) = row(column).ToString.Replace(...)
か、
If row(column).ToString = 置換される文字列(か変数)、
Then Assign → row(column) = 置換文字列(か変数)
教えていただいた通りに修正できました。
I was able to fix it exactly as I taught.
確かに、System.Data.DataColumnに設定しておけば
.tostringは不要ですね:smile:
surely, if you set it to System.Data.DataColumn for for each type
.tostring was unnecessary.
色々と教えていただいて感謝でいっぱいです。
私もいつかあなたのように誰かを助けてあげられるよう、頑張ります(^▽^*)
I am filled with appreciation for telling me various things.
I also want to be able to help someone like you some day (^ ▽ ^ *)