小编K B*_*K B的帖子

简化/清理DOCX word文档的XML

我有一个Microsoft Word文档(docx),我使用Open XML SDK 2.0 Productivity Tool从中生成C#代码.

我想以编程方式将一些数据库值插入到文档中.为此我输入了简单的文本,如[[place holder 1]],我的程序应该用它的数据库值替换占位符.

不幸的是,XML输出处于某种混乱状态.例如,我有一个包含两个相邻单元格的表格,这些单元格不应与其占位符区分开来.但其中一个占位符分为几个版本.

[[好地方持有人]]

<w:tc xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
  <w:tcPr>
    <w:tcW w:w="1798" w:type="dxa" />
    <w:shd w:val="clear" w:color="auto" w:fill="auto" />
  </w:tcPr>
  <w:p w:rsidRPr="008C2E16" w:rsidR="001F54BF" w:rsidP="000D7B67" w:rsidRDefault="0009453E">
    <w:pPr>
      <w:spacing w:after="0" w:line="240" w:lineRule="auto" />
      <w:rPr>
        <w:rFonts w:cstheme="minorHAnsi" />
        <w:sz w:val="20" />
        <w:szCs w:val="20" />
      </w:rPr>
    </w:pPr>
    <w:r w:rsidRPr="0009453E">
      <w:rPr>
        <w:rFonts w:cstheme="minorHAnsi" />
        <w:sz w:val="20" />
        <w:szCs w:val="20" />
      </w:rPr>
      <w:t>[[good place holder]]</w:t>
    </w:r>
  </w:p>
</w:tc>
Run Code Online (Sandbox Code Playgroud)

[[坏地方持有人]]

<w:tc xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
  <w:tcPr>
    <w:tcW w:w="1799" w:type="dxa" /> …
Run Code Online (Sandbox Code Playgroud)

c# xml ms-word openxml openxml-sdk

18
推荐指数
1
解决办法
1万
查看次数

使用C#程序从praat获取值

我有一个用C#编写的程序和由praat(phonetics软件)计算的值.我已经有一个使用praatcon.exe运行的praat脚本,它在Windows控制台(cmd.exe)上打印结果.我可以在C#应用程序中使用此结果吗?怎么样?

或者有更好的方法来获得结果,例如使用命令"sentocket"?怎么用这个?

编辑:它适用于以下代码:

ProcessStartInfo si = new ProcessStartInfo();
si.FileName = "praatcon.exe"; //name of the handle program from sysinternals
//assumes that it is in the exe directory or in your path
//environment variable

//the following three lines are required to be able to read the output (StandardOutput)
//and hide the exe window. 
si.RedirectStandardOutput = true;
si.WindowStyle = ProcessWindowStyle.Hidden;
si.UseShellExecute = false;

si.Arguments = "-a example.praat filename.wav"; //you can specify whatever parameters praatcon.exe needs here; -a is mandatory!

//these 4 lines …
Run Code Online (Sandbox Code Playgroud)

.net c# phonetics

4
推荐指数
1
解决办法
1059
查看次数

标签 统计

c# ×2

.net ×1

ms-word ×1

openxml ×1

openxml-sdk ×1

phonetics ×1

xml ×1