本身将Infopath表单转成PDF不复杂,从网上找到这段代码本身有点令我惊喜。
var formData =newXmlDocument();
var xslt =newXslCompiledTransform(true);
// Load the form data
formData.LoadXml(MainDataSource.CreateNavigator().InnerXml);
// Extract the stylesheet from the package
xslt.Load(ExtractFromPackage("Print.xsl"));// (uses Template.OpenFileFromPackage(string fileName) to get xsl)
// Perform XSL-transformation
// [...]
// Send HTML to web part
this.NotifyHost(formData.InnerXml);