diff --git a/Tables/Set-table-row-height/.NET/Set-table-row-height.sln b/Tables/Set-table-row-height/.NET/Set-table-row-height.sln new file mode 100644 index 000000000..e4bcb5772 --- /dev/null +++ b/Tables/Set-table-row-height/.NET/Set-table-row-height.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31911.196 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set-table-row-height", "Set-table-row-height\Set-table-row-height.csproj", "{C17B90BC-F559-456B-B189-90B53FF6CDD4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C17B90BC-F559-456B-B189-90B53FF6CDD4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EF357FC6-E9E5-4E3C-B932-43F727BE1DE4} + EndGlobalSection +EndGlobal diff --git a/Tables/Set-table-row-height/.NET/Set-table-row-height/Data/Template.docx b/Tables/Set-table-row-height/.NET/Set-table-row-height/Data/Template.docx new file mode 100644 index 000000000..adc4504fb Binary files /dev/null and b/Tables/Set-table-row-height/.NET/Set-table-row-height/Data/Template.docx differ diff --git a/Tables/Set-table-row-height/.NET/Set-table-row-height/Output/.gitkeep b/Tables/Set-table-row-height/.NET/Set-table-row-height/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Tables/Set-table-row-height/.NET/Set-table-row-height/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tables/Set-table-row-height/.NET/Set-table-row-height/Program.cs b/Tables/Set-table-row-height/.NET/Set-table-row-height/Program.cs new file mode 100644 index 000000000..bef63327f --- /dev/null +++ b/Tables/Set-table-row-height/.NET/Set-table-row-height/Program.cs @@ -0,0 +1,40 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; +using Syncfusion.Licensing; +using System.IO; + +namespace Set_table_row_height +{ + class Program + { + static void Main(string[] args) + { + using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + { + //Loads the template document. + using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx)) + { + //Gets the text body of first section. + WTextBody textbody = document.Sections[0].Body; + //Gets the table. + IWTable table = textbody.Tables[0]; + //Iterates through table rows. + foreach (WTableRow row in table.Rows) + { + WTableRow tableRow = row as WTableRow; + //Set table row height. + tableRow.Height = 30.2f; + //Set table row height type. + tableRow.HeightType = TableRowHeightType.Exactly; + } + //Creates file stream. + using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite)) + { + //Saves the Word document to file stream. + document.Save(outputFileStream, FormatType.Docx); + } + } + } + } + } +} diff --git a/Tables/Set-table-row-height/.NET/Set-table-row-height/Set-table-row-height.csproj b/Tables/Set-table-row-height/.NET/Set-table-row-height/Set-table-row-height.csproj new file mode 100644 index 000000000..37fac100b --- /dev/null +++ b/Tables/Set-table-row-height/.NET/Set-table-row-height/Set-table-row-height.csproj @@ -0,0 +1,22 @@ + + + + Exe + net8.0 + Set_table_row_height + + + + + + + + + Always + + + Always + + + +