Файл загружается на серверную часть через службу отдыха.
Пример файла можно можно найти здесь: https://github.com/user-attachments/fil ... olDoc.docx
Сервис проверяет файл с помощью Open-XML-SDK (https:// github.com/dotnet/Open-XML-SDK), но возвращает следующую ошибку:
Элемент имеет недопустимый дочерний элемент http://schemas.openxmlformats.org/wordprocessingml /2006/main:rtl
Ниже приведен код:
Код: Выделить всё
Stream fileStream = new MemoryStream(Convert.FromBase64String(documento.StringBase64));
string errorDescription = "";
WordprocessingDocument? wordprocessingDocument = null;
int count = 0;
try
{
wordprocessingDocument = WordprocessingDocument.Open(fileStream, false);
OpenXmlValidator validator = new OpenXmlValidator(DocumentFormat.OpenXml.FileFormatVersions.Microsoft365);
foreach (ValidationErrorInfo error in validator.Validate(wordprocessingDocument))
{
count++;
if (count == 1)
errorDescription = "Description: " + error.Description;
else
errorDescription += error.Description;
}
}
catch (Exception ex)
{
count++;
errorDescription = ex.Message;
}
finally
{
if(wordprocessingDocument is not null)
wordprocessingDocument.Dispose();
}
Может ли кто-нибудь помочь мне понять? ?
Спасибо!
Элемент имеет недопустимый дочерний элемент http://schemas.openxmlformats.org/wordp ... /2006/main: rtl
Я ожидал, что проверка пройдет успешно.
Подробнее здесь: https://stackoverflow.com/questions/787 ... hemas-open