Hello Team,
I am trying to copy/paste from the system clipboard but I keep getting server status 500. Copy/paste within the document works fine but when I copy a text from outside documenteditor it comes with this error.
Could you please assist in resolving this issue?
public class CustomParam
{
public string content { get; set; }
public string type { get; set; }
}
[AcceptVerbs("Post")]
[HttpPost]
[EnableCors("AllowAllOrigins")]
[Route("SystemClipboard")]
public string SystemClipboard([FromBody] CustomParam param)
{
if (param.content != null && param.content != "")
{
try
{
WordDocument document = WordDocument.LoadString(param.content, GetFormatType(param.type.ToLower()));
string json = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
return json;
}
catch (Exception)
{
return "";
}
}
return "";
}