Closed rstm-sf closed 1 year ago
internal static void Example_BasicLists_Save_To_Stream(string folderPath, bool openWord) { using var document = WordDocument.Create(); foreach (var listStyle in (WordListStyle[])Enum.GetValues(typeof(WordListStyle))) { var paragraph = document.AddParagraph(listStyle.ToString()); paragraph.SetColor(Color.Red).SetBold(); paragraph.ParagraphAlignment = JustificationValues.Center; var wordList1 = document.AddList(listStyle); wordList1.AddItem("Text 1", 0); wordList1.AddItem("Text 2", 1); wordList1.AddItem("Text 3", 2); wordList1.AddItem("Text 4", 3); wordList1.AddItem("Text 5", 4); wordList1.AddItem("Text 6", 5); wordList1.AddItem("Text 7", 6); wordList1.AddItem("Text 8", 7); wordList1.AddItem("Text 9", 8); } using var outputStream = new MemoryStream(); document.Save(outputStream); var filePath = Path.Combine(folderPath, "Document with Lists when save to stream.docx"); File.WriteAllBytes(filePath, outputStream.ToArray()); if (openWord) { Helpers.Open(filePath, openWord); } }
Any guess why and how to fix it?