在我的 MVC 应用程序中,我想在 CKEDITOR 中显示提取的文本。但是文本在 textarea 中而不是在编辑器中显示我的控制器代码是:
public ActionResult ExtractText(string fn)
{
string extFile = Server.MapPath(_fileUploadPath + fn);
string filePath = Path.Combine(HttpContext.Server.MapPath(_fileUploadPath), Path.GetFileName(fn));
if (filePath != null)
{
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
f.OpenPdf(System.IO.File.ReadAllBytes(filePath));
string text = f.ToText();
string sValue = "<textarea id = \"temp_edit\" name=\"content\" cols=\"73\" rows=\"15\">" + text + "</textarea> <script type=\"text/javascript\">CKEDITOR.replace('temp_edit');</script><input class=\"margin-top-05 green_button\" type=\"button\" value=\"Save\" onclick=\"save_file()\" /><a class=\"close\" onclick=\"parent.$.fancybox.close();\"><img class=\"close_image\" title=\"close\" src=\"../images/closelabel.gif\" style=\"width: auto; height: auto; position: absolute; bottom: 0px; right: 0px;\"></a>";
return Content(sValue);
}
else
{
TempData["UploadValidationMessage_Failure"] = "File does not exist";
return View();
}
}