无法编译此F#代码,因为它不正确地从C#中转换。无法编译此F#代码
似乎存在与lambda表达式
namespace OpenXML
open DocumentFormat.OpenXml
open DocumentFormat.OpenXml.Packaging
open DocumentFormat.OpenXml.Wordprocessing
// Add the DocumentFormat.OpenXml assembly
// Add the WindowsBase assembly
module public Word =
let query_plain_text_content_control (document_path_and_file_name :string) (content_control_tag :string) =
use theDoc = WordprocessingDocument.Open(document_path_and_file_name, true)
let mainPart = theDoc.MainDocumentPart
let block = mainPart.Document.Body.Descendants<SdtElement>().Where(r :> r.SdtProperties.GetFirstChild<Tag>().Val = content_control_tag).Single()
let t = block.Descendants<Text>().FirstOrDefault()
t.Text
let update_plain_text_content_control (document_path_and_file_name :string) (content_control_tag :string) (new_text :string) = async {
use theDoc = WordprocessingDocument.Open(document_path_and_file_name, true)
let mainPart = theDoc.MainDocumentPart
let block = mainPart.Document.Body.Descendants<SdtElement>().Where(r :> r.SdtProperties.GetFirstChild<Tag>().Val = content_control_tag).Single()
let t = block.Descendants<Text>().FirstOrDefault()
t.Text = new_text
mainPart.Document.Save() |> ignore
}
您应该确保包含确切的错误消息及其发生的行。 – crashmstr 2014-10-01 16:05:02
欢迎!请包括您得到的确切错误。 – 2014-10-01 16:05:13
错误意外的符号表达式中的'(',第14行, 错误绑定中的意外符号')'。在此点或其他标记之前或之前预期的不完整结构化构造。 \t第14行, 错误意外的符号'('在表达式中,第21行,错误意外的符号')'在绑定中。在此点或其他标记之前或之前预期的不完整结构化构造。 \t第21行 – 2014-10-01 16:16:35