diff --git a/HTML-conversions/Convert_EMF-images_to_PNG_in_Word-document/.NET/Convert_EMF-images_to_PNG_in_Word-document/Program.cs b/HTML-conversions/Convert_EMF-images_to_PNG_in_Word-document/.NET/Convert_EMF-images_to_PNG_in_Word-document/Program.cs
index e09fb0c6..9d8d29ff 100644
--- a/HTML-conversions/Convert_EMF-images_to_PNG_in_Word-document/.NET/Convert_EMF-images_to_PNG_in_Word-document/Program.cs
+++ b/HTML-conversions/Convert_EMF-images_to_PNG_in_Word-document/.NET/Convert_EMF-images_to_PNG_in_Word-document/Program.cs
@@ -44,7 +44,9 @@
picture.Height = height;
picture.Width = width;
}
+ imageByteStream.Dispose();
}
+ stream.Dispose();
}
// Save the modified document to the specified output file.
using (FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.html"), FileMode.Create, FileAccess.Write))
diff --git a/Paragraphs/Set-Proofing-for-Word-document/.NET/Set-Proofing-for-Word-document/Program.cs b/Paragraphs/Set-Proofing-for-Word-document/.NET/Set-Proofing-for-Word-document/Program.cs
index acb223ff..2b03fb73 100644
--- a/Paragraphs/Set-Proofing-for-Word-document/.NET/Set-Proofing-for-Word-document/Program.cs
+++ b/Paragraphs/Set-Proofing-for-Word-document/.NET/Set-Proofing-for-Word-document/Program.cs
@@ -127,6 +127,16 @@ private static void IterateParagraph(ParagraphItemCollection paraItems)
InlineContentControl inlineContentControl = entity as InlineContentControl;
IterateParagraph(inlineContentControl.ParagraphItems);
break;
+ case EntityType.Symbol:
+ WSymbol symbol = entity as WSymbol;
+ symbol.CharacterFormat.LocaleIdASCII = (short)LocaleIDs.fr_FR;
+ break;
+ case EntityType.Footnote:
+ WFootnote footer = entity as WFootnote;
+ footer.MarkerCharacterFormat.LocaleIdASCII = (short)LocaleIDs.fr_FR;
+ // Also iterate its TextBody to set on inner WTextRange
+ IterateTextBody(footer.TextBody);
+ break;
}
}
}
diff --git a/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable.sln b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable.sln
new file mode 100644
index 00000000..38c7ba1b
--- /dev/null
+++ b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36930.0 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Extract-Table-to-DataTable", "Extract-Table-to-DataTable\Extract-Table-to-DataTable.csproj", "{109F9D9A-2486-6191-E3ED-B9C89550B0D4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {109F9D9A-2486-6191-E3ED-B9C89550B0D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {109F9D9A-2486-6191-E3ED-B9C89550B0D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {109F9D9A-2486-6191-E3ED-B9C89550B0D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {109F9D9A-2486-6191-E3ED-B9C89550B0D4}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8D7007A5-9202-4A9B-A8E2-50EAB025B312}
+ EndGlobalSection
+EndGlobal
diff --git a/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Data/Input.docx b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Data/Input.docx
new file mode 100644
index 00000000..94acc0a0
Binary files /dev/null and b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Data/Input.docx differ
diff --git a/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Extract-Table-to-DataTable.csproj b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Extract-Table-to-DataTable.csproj
new file mode 100644
index 00000000..91411574
--- /dev/null
+++ b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Extract-Table-to-DataTable.csproj
@@ -0,0 +1,24 @@
+
+
+
+ Exe
+ net8.0
+ Extract-Table-to-DataTable
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+ Always
+
+
+ Always
+
+
+
diff --git a/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Output/.gitkeep b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Output/.gitkeep
new file mode 100644
index 00000000..5f282702
--- /dev/null
+++ b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Output/.gitkeep
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Output/Result.xlsx b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Output/Result.xlsx
new file mode 100644
index 00000000..332d028d
Binary files /dev/null and b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Output/Result.xlsx differ
diff --git a/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Program.cs b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Program.cs
new file mode 100644
index 00000000..45639a99
--- /dev/null
+++ b/Tables/Extract-Table-to-DataTable/.NET/Extract-Table-to-DataTable/Program.cs
@@ -0,0 +1,171 @@
+using System.Text;
+using Syncfusion.DocIO;
+using Syncfusion.DocIO.DLS;
+using Syncfusion.XlsIO;
+
+class Program
+{
+ static void Main(string[] args)
+ {
+ // Load existing word document
+ using (FileStream inputfileStream = new FileStream(Path.GetFullPath(@"../../../Data/Input.docx"), FileMode.Open))
+ {
+ using (WordDocument document = new WordDocument(inputfileStream, FormatType.Automatic))
+ {
+ using (ExcelEngine engine = new ExcelEngine())
+ {
+ IApplication app = engine.Excel;
+ app.DefaultVersion = ExcelVersion.Excel2016;
+
+ // Create one sheet to start with; we’ll add sheets as we find more tables.
+ IWorkbook workbook = app.Workbooks.Create(1);
+ int sheetIndex = 0;
+ int tableNumber = 0;
+
+ // Get table entities in word document
+ List entities = document.FindAllItemsByProperty(EntityType.Table, null, null);
+
+ foreach (Entity entity in entities)
+ {
+ WTable wTable = (WTable)entity;
+
+ if (sheetIndex >= workbook.Worksheets.Count)
+ workbook.Worksheets.Create();
+
+ IWorksheet worksheet = workbook.Worksheets[sheetIndex++];
+ worksheet.Name = $"Table{++tableNumber}";
+
+ // Export with merges starting at row=1, col=1
+ ExportWordTableToExcelMerged(wTable, worksheet, 1, 1);
+
+ // Formatting
+ worksheet.UsedRange.AutofitRows();
+ worksheet.UsedRange.AutofitColumns();
+ }
+ using (FileStream outputStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.xlsx"), FileMode.Create))
+ {
+ workbook.SaveAs(outputStream);
+ }
+ workbook.Close();
+ }
+ }
+ }
+ }
+
+ ///
+ /// Writes a Word table to the worksheet, preserving horizontal and vertical merges.
+ /// startRow/startCol are 1-based Excel coordinates where the table should be placed.
+ ///
+ private static void ExportWordTableToExcelMerged(IWTable table, IWorksheet worksheet, int startRow, int startCol)
+ {
+ // Iterate table rows
+ for (int r = 0; r < table.Rows.Count; r++)
+ {
+ WTableRow wRow = table.Rows[r];
+
+ // Map Word's logical grid to Excel columns using GridSpan
+ int gridCol = startCol;
+
+ for (int i = 0; i < wRow.Cells.Count; i++)
+ {
+ WTableCell wCell = wRow.Cells[i];
+
+ // Horizontal width in grid columns
+ int hSpan = Math.Max(1, (int)wCell.GridSpan);
+
+ // Merge flags (DocIO)
+ CellMerge vFlag = wCell.CellFormat.VerticalMerge;
+ CellMerge hFlag = wCell.CellFormat.HorizontalMerge;
+
+ // Excel start cell for this Word cell
+ int xRow = startRow + r;
+ int xCol = gridCol;
+
+ // Compute vertical span when this cell is the START of a vertical merge
+ int vSpan = 1;
+ if (vFlag == CellMerge.Start)
+ {
+ // Count how many subsequent rows continue the merge at the same grid column
+ for (int nr = r + 1; nr < table.Rows.Count; nr++)
+ {
+ WTableRow nextRow = table.Rows[nr];
+ WTableCell nextCell = GetCellAtGridColumn(nextRow, (xCol - startCol + 1));
+ if (nextCell != null && nextCell.CellFormat.VerticalMerge == CellMerge.Continue)
+ vSpan++;
+ else
+ break;
+ }
+ }
+
+ // Is Start or None of a merge region
+ bool isStartorNone =
+ (vFlag != CellMerge.Continue) &&
+ (hFlag != CellMerge.Continue);
+
+ if (isStartorNone)
+ {
+ // To get the exact lest row and last column -1
+ int lastRow = xRow + vSpan - 1;
+ int lastCol = xCol + hSpan - 1;
+
+ // Merge in Excel if region spans multiple cells
+ if (lastRow > xRow || lastCol > xCol)
+ worksheet.Range[xRow, xCol, lastRow, lastCol].Merge(); // XlsIO merge
+
+ // Write the visible text to the top-left Excel cell
+ IRange range = worksheet.Range[xRow, xCol];
+ range.Text = BuildCellText(wCell);
+
+ // Text styling
+ range.CellStyle.HorizontalAlignment = ExcelHAlign.HAlignCenter;
+ range.CellStyle.VerticalAlignment = ExcelVAlign.VAlignCenter;
+ // Border formatting
+ worksheet.Range[xRow, xCol, lastRow, lastCol].CellStyle.Borders[ExcelBordersIndex.EdgeLeft].LineStyle = ExcelLineStyle.Thin;
+ worksheet.Range[xRow, xCol, lastRow, lastCol].CellStyle.Borders[ExcelBordersIndex.EdgeRight].LineStyle = ExcelLineStyle.Thin;
+ worksheet.Range[xRow, xCol, lastRow, lastCol].CellStyle.Borders[ExcelBordersIndex.EdgeTop].LineStyle = ExcelLineStyle.Thin;
+ worksheet.Range[xRow, xCol, lastRow, lastCol].CellStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin;
+ }
+ // Add Excel column cursor by the horizontal span of this Word cell
+ gridCol += hSpan;
+ }
+ }
+ }
+
+ ///
+ /// Returns the WTableCell occupying the given 1-based "grid column" in this row,
+ /// taking each cell's GridSpan into account.
+ ///
+ static WTableCell GetCellAtGridColumn(WTableRow row, int gridColumn)
+ {
+ int cursor = 1;
+ foreach (WTableCell c in row.Cells)
+ {
+ int span = Math.Max((int)1, (int)c.GridSpan);
+ int start = cursor;
+ int end = cursor + span - 1;
+ if (gridColumn >= start && gridColumn <= end)
+ return c;
+ cursor += span;
+ }
+ return null;
+ }
+
+ ///
+ /// Concatenate all paragraph texts in a Word cell (one per line).
+ ///
+ static string BuildCellText(WTableCell cell)
+ {
+ StringBuilder sb = new StringBuilder();
+ for (int p = 0; p < cell.Paragraphs.Count; p++)
+ {
+ WParagraph para = (WParagraph)cell.Paragraphs[p];
+ string text = para.Text?.TrimEnd();
+ if (!string.IsNullOrEmpty(text))
+ {
+ if (sb.Length > 0) sb.AppendLine();
+ sb.Append(text);
+ }
+ }
+ return sb.ToString();
+ }
+}
\ No newline at end of file