Epplus:如何在字符串连接公式中显示双引号

Epplus : how to display double quaotes in string concatenation formula

我想在列 1 中显示如下内容:

  Unique Identifier       Display_Reg    Year   Month   Region  LO Count    
        2016_Apr_ENY    ENY     2016    Apr Albany     10   
        2016_Mar_ENY    ENY     2016    Mar Albany     11

我在第 1 列的单元格中获取的值为:

 worksheet_LO.Cells[Rowcount, 1].Formula = "=CONCATENATE(C" + Rowcount + "," +"D" + Rowcount + "," + "B" + Rowcount + ")";
 worksheet_LO.Cells[Rowcount, 1].Calculate();

上面给我的结果是 2016AprEny。 如何在其中显示下划线。

目标是在单元格中使用此公式结束:

=CONCATENATE(C1,"_",D1,"_",B1)

要实现此目的,您需要将 ,"_", 字符串添加到只有 , 的串联中。为了做到这一点,我们需要小心地通过在前面添加另一个字符来转义 " 字符。

应该这样做:

worksheet_LO.Cells[Rowcount, 1].Formula = "=CONCATENATE(C" + Rowcount +@",""_"","+"D" + Rowcount + @",""_""," + "B" + Rowcount + ")";
worksheet_LO.Cells[Rowcount, 1].Calculate();