本文整理汇总了C#中Reader.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Reader.Execute方法的具体用法?C# Reader.Execute怎么用?C# Reader.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestReadSimpleDocx
public void TestReadSimpleDocx()
{
Reader r = new Reader();
r.Source = new DocumentSource();
using (r.Source.Data = File.Open(TestFilePath + "test.docx", FileMode.Open))
{
r.Consumer = new DummyConsumer();
r.Execute();
}
}
示例2: AssertCompilationSame
protected void AssertCompilationSame(string refName, Type baseType)
{
var xReader = new Reader();
var xResult = xReader.Execute(baseType.Assembly.Location);
string xActualOutput;
using (var xStringWriter = new StringWriter())
{
using (var xXmlOut = XmlWriter.Create(xStringWriter))
{
Dump.DumpTypes(xResult, xXmlOut);
xXmlOut.Flush();
xStringWriter.Flush();
xActualOutput = xStringWriter.ToString();
}
}
var xExpectedOutput = ReadAllTextFromStream(baseType.Assembly.GetManifestResourceStream(baseType.Namespace + "." + refName + ".xml"));
Assert.AreEqual(xExpectedOutput, xActualOutput);
}
示例3: TestReadDocxHeaderFooters
public void TestReadDocxHeaderFooters()
{
Reader r = new Reader();
r.Source = new DocumentSource();
DummyConsumer consumer = new DummyConsumer();
using (r.Source.Data = File.Open(TestFilePath + "testheaders.docx", FileMode.Open))
{
r.Consumer = consumer;
r.Execute();
}
Assert.AreEqual(16, consumer.Counts["HeaderFooter"]);
bool bExpectStart = true;
int iCount = 0;
foreach (DocElement de in consumer.elements)
{
if (de is Section)
{
Assert.IsTrue(de.IsStart, "Expect to get all the hdr/footer stuff done before the end of hte first section");
}
if (de is HeaderFooter)
{
Assert.AreEqual(bExpectStart, de.IsStart);
bExpectStart = !bExpectStart;
iCount++;
if (iCount == 12)
break;
}
}
}
示例4: ReadDocument
private static DummyConsumer ReadDocument(string fileName)
{
Reader r = new Reader();
r.Source = new DocumentSource();
DummyConsumer consumer = new DummyConsumer();
using (r.Source.Data = File.Open(TestFilePath + fileName, FileMode.Open))
{
r.Consumer = consumer;
r.Execute();
}
return consumer;
}