This is my code. It is processed only english language word document not chinese language word document.
public static byte[] ConvertFile(ITracingService tracingService, byte[] infile, string url)
{
byte[] toArray;
try
{
using (HttpClient httpClient = new HttpClient())
{
MultipartFormDataContent multipartContent = new MultipartFormDataContent();
ByteArrayContent byteArrayContent = new ByteArrayContent(infile);
byteArrayContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") {FileName = "file"};
byteArrayContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
multipartContent.Add(byteArrayContent);
HttpResponseMessage retrieveResponse = httpClient.PostAsync(url, multipartContent).Result;
if (retrieveResponse.IsSuccessStatusCode)
toArray = retrieveResponse.Content.ReadAsByteArrayAsync().Result;
else
{
tracingService.Trace($"Error in ConvertFile: {retrieveResponse.StatusCode}");
throw new InvalidPluginExecutionException($"Error in ConvertFile: {retrieveResponse.StatusCode}");
}
}
}
catch (Exception e)
{
tracingService.Trace($"Error in ConvertFile: {e}");
throw new InvalidPluginExecutionException(e.Message);
}
return toArray;
}
the code you posted is dealing only with binary data, has nothing to do with the language inside the word document (or if is a word document at all)
André Arnaud de Cal...
292,031
Super User 2025 Season 1
Martin Dráb
230,868
Most Valuable Professional
nmaenpaa
101,156