Skip to content

Commit

Permalink
Word Export LT-21942: Fixed more Export failures
Browse files Browse the repository at this point in the history
When testing with Steve’s Project additional failures were found:
1. Open image files with read access. The same image can be used
by multiple entries. We were trying to open the same file with
write access from different threads.
2. Use FirstOrDefault() instead of First().

Change-Id: I1ac9ef7f21324165c0d1494f66aa80cdc58d8fb1
  • Loading branch information
mark-sil committed Oct 2, 2024
1 parent ba50e63 commit f9da458
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ public static string AddImagePartToPackage(WordprocessingDocument doc, string im
{
MainDocumentPart mainPart = doc.MainDocumentPart;
ImagePart imagePart = mainPart.AddImagePart(imageType);
using (FileStream stream = new FileStream(imagePath, FileMode.Open))
using (FileStream stream = new FileStream(imagePath, FileMode.Open, FileAccess.Read))
{
imagePart.FeedData(stream);
}
Expand Down Expand Up @@ -2418,7 +2418,7 @@ private void AddBulletAndNumberingData(IFragment elementContent, ConfigurableDic
{
if (elem is Paragraph)
{
var paraProps = elem.Elements<ParagraphProperties>().First();
var paraProps = elem.Elements<ParagraphProperties>().FirstOrDefault();
if (paraProps != null)
{
// Only add the uniqueId to paragraphs with the correct style. There could
Expand Down

0 comments on commit f9da458

Please sign in to comment.