Skip to content

Commit 67a82dc

Browse files
Addressed the feedbacks
1 parent 74bb725 commit 67a82dc

File tree

1 file changed

+8
-11
lines changed
  • Tables/Reduce-height-of-empty-cells/.NET/Reduce-height-of-empty-cells

1 file changed

+8
-11
lines changed
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
using Syncfusion.DocIO;
22
using Syncfusion.DocIO.DLS;
33

4-
// Open the existing Word document ("Template.docx") for reading and writing.
54
using (FileStream inputFileStream = new FileStream(Path.GetFullPath("Data/Template.docx"), FileMode.Open, FileAccess.ReadWrite))
65
{
7-
//Opens an input Word template.
6+
//Opens an template Word document.
87
using (WordDocument document = new WordDocument(inputFileStream, FormatType.Docx))
98
{
10-
// Retrieve the last section of the document.
9+
//Retrieve the last section of the document.
1110
IWSection section = document.LastSection;
12-
// Retrieve the first table from the section.
11+
//Retrieve the first table from the section.
1312
IWTable table = section.Body.Tables[0];
14-
// Iterate through each row in the table.
13+
//Iterate through each row in the table.
1514
foreach (WTableRow row in table.Rows)
1615
{
17-
// Set the row height type to "AtLeast" and height to 0 to minimize height.
16+
//Set the row height type to "AtLeast" and height to 0 to minimize height.
1817
row.HeightType = TableRowHeightType.AtLeast;
1918
row.Height = 0;
20-
// Iterate through each cell in the row.
19+
//Iterate through each cell in the row.
2120
foreach (WTableCell cell in row.Cells)
2221
{
23-
// Remove top and bottom margins of the cell.
22+
//Remove top and bottom margins of the cell.
2423
cell.CellFormat.Paddings.Top = 0;
2524
cell.CellFormat.Paddings.Bottom = 0;
26-
// Iterate through paragraphs in each cell.
25+
//Iterate through paragraphs in each cell.
2726
foreach (IWParagraph paragraph in cell.Paragraphs)
2827
{
2928
paragraph.BreakCharacterFormat.FontSize = 8;
@@ -35,7 +34,5 @@
3534
{
3635
document.Save(outputFileStream, FormatType.Docx);
3736
}
38-
//Close the document.
39-
document.Close();
4037
}
4138
}

0 commit comments

Comments
 (0)