When copy-pasting a cell from Excel to the Spreadsheet, our component then generates an invalid horizontal alignment value, which does not conform to the document format specification:
<alignment horizontal="start" vertical="bottom" />The valid values for horizontal do not include start:
<simpleType name="ST_HorizontalAlignment">
<restriction base="xsd:string">
<enumeration value="general"/>
<enumeration value="left"/>
<enumeration value="center"/>
<enumeration value="right"/>
<enumeration value="fill"/>
<enumeration value="justify"/>
<enumeration value="centerContinuous"/>
<enumeration value="distributed"/>
</restriction>
</simpleType>Here are the steps:
1. Copy some basic content from Excel (two text cells)
2. Paste the content to the Telerik Blazor Spreadsheet component and save the XLSX file
This bug makes it very hard to import data. The only work around I've managed to use is to sanitize the stream before importing it.
```
private static MemoryStream SanitizeXlsxStream(Stream input) {
using ZipArchive archive = new(input, ZipArchiveMode.Read, true);
MemoryStream outMs = new();
using (ZipArchive newArchive = new(outMs, ZipArchiveMode.Create, true)) {
foreach (ZipArchiveEntry entry in archive.Entries) {
ZipArchiveEntry newEntry = newArchive.CreateEntry(entry.FullName, CompressionLevel.Optimal);
using Stream src = entry.Open();
using Stream dst = newEntry.Open();
if (string.Equals(entry.FullName, "xl/styles.xml", StringComparison.OrdinalIgnoreCase)) {
using StreamReader sr = new(src, Encoding.UTF8);
string xml = sr.ReadToEnd();
xml = xml.Replace("horizontal=\"start\"", "horizontal=\"left\"")
.Replace("horizontal=\"end\"", "horizontal=\"right\"");
using StreamWriter sw = new(dst, Encoding.UTF8);
sw.Write(xml);
} else {
src.CopyTo(dst);
}
}
}
outMs.Position = 0;
return outMs;
}
```