無法編譯此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