Skip to content

Commit 666fb43

Browse files
Addressed the feedbacks in the KB
1 parent a937e9f commit 666fb43

File tree

9 files changed

+25
-18
lines changed

9 files changed

+25
-18
lines changed

Mail-Merge/Modify-font-during-mail-merge/.NET/Modify-font-during-mail-merge/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ static void Main(string[] args)
3535
/// </summary>
3636
private static void ModifyFont(object sender, MergeFieldEventArgs args)
3737
{
38+
// Sets the font name to Arial for the selected text range.
3839
args.TextRange.CharacterFormat.FontName = "Arial";
40+
// Sets the font size to 18 points for the selected text range.
3941
args.TextRange.CharacterFormat.FontSize = 18;
42+
// Applies bold formatting to the selected text range.
4043
args.TextRange.CharacterFormat.Bold = true;
44+
// Applies italic formatting to the selected text range.
4145
args.TextRange.CharacterFormat.Italic = true;
46+
// Applies single underline to the selected text range.
4247
args.TextRange.CharacterFormat.UnderlineStyle = UnderlineStyle.Single;
4348
}
4449

@@ -47,17 +52,26 @@ private static void ModifyFont(object sender, MergeFieldEventArgs args)
4752
/// </summary>
4853
private static DataTable GetDataTable()
4954
{
55+
// Creates a new DataTable with the name "Employee".
5056
DataTable dataTable = new DataTable("Employee");
57+
// Adds a column "EmployeeName" to the DataTable.
5158
dataTable.Columns.Add("EmployeeName");
59+
// Adds a column "EmployeeNumber" to the DataTable.
5260
dataTable.Columns.Add("EmployeeNumber");
5361

62+
// Loops 20 times to add rows to the DataTable.
5463
for (int i = 0; i < 20; i++)
5564
{
65+
// Creates a new DataRow for the DataTable.
5666
DataRow datarow = dataTable.NewRow();
67+
// Adds the newly created DataRow to the DataTable.
5768
dataTable.Rows.Add(datarow);
69+
// Sets the value of the first column (EmployeeName) for the current row.
5870
datarow[0] = "Employee" + i.ToString();
71+
// Sets the value of the second column (EmployeeNumber) for the current row.
5972
datarow[1] = "EMP" + i.ToString();
6073
}
74+
// Returns the populated DataTable.
6175
return dataTable;
6276
}
6377
#endregion

Paragraphs/Apply-indentation-for-import-content/.NET/Apply-indentation-for-import-content/Apply-indentation-for-import-content.csproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<None Update="Data\Main.docx">
16+
<None Update="Data\SourceDocument.docx">
1717
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
1818
</None>
19-
<None Update="Data\REKOMENDASI.docx">
20-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21-
</None>
22-
<None Update="Data\Temporary.docx">
19+
<None Update="Data\DestinationDocument.docx">
2320
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2421
</None>
2522
<None Update="Output\.gitkeep">

Paragraphs/Apply-indentation-for-import-content/.NET/Apply-indentation-for-import-content/Program.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using Syncfusion.DocIO;
22
using Syncfusion.DocIO.DLS;
33

4-
54
//Open the existing main document.
6-
FileStream fileStream1 = new FileStream(Path.GetFullPath(@"Data/Main.docx"), FileMode.Open);
5+
FileStream fileStream1 = new FileStream(Path.GetFullPath(@"Data/SourceDocument.docx"), FileMode.Open);
76
WordDocument mainDocument = new WordDocument(fileStream1, FormatType.Docx);
87
//Open the existing temporary document.
9-
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/REKOMENDASI.docx"), FileMode.Open);
8+
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/DestinationDocument.docx"), FileMode.Open);
109
WordDocument tempDoc = new WordDocument(fileStream, FormatType.Docx);
1110
//Set the first section break.
1211
tempDoc.Sections[0].BreakCode = SectionBreakCode.NoBreak;
@@ -25,10 +24,12 @@
2524
AddLeftIndentation(mainDocument, secIndex, paraIndex + 1, lastPara.ParagraphFormat.LeftIndent);
2625

2726
//Save the main document.
28-
FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output_REKOMENDASI.docx"), FileMode.Create, FileAccess.Write);
27+
FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Output.docx"), FileMode.Create, FileAccess.Write);
2928
mainDocument.Save(outputStream, FormatType.Docx);
3029

31-
30+
/// <summary>
31+
/// Applies left indentation to paragraphs and tables in a specified section and paragraph range of a Word document.
32+
/// </summary>
3233
void AddLeftIndentation(WordDocument document1, int secIndex, int paraIndex, float leftIndent)
3334
{
3435
//Iterate through the sections added from the temporary document.

Word-to-PDF-Conversion/Replace-Excel-embedded-image-to-PNG/.NET/Replace-Excel-embedded-image-to-PNG/Program.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@
88
using Syncfusion.XlsIO;
99
using Syncfusion.XlsIORenderer;
1010

11-
12-
// Disable the PDF document cache to prevent caching of rendered pages
13-
PdfDocument.EnableCache = false;
1411
// Initialize the DocIORenderer component for converting Word documents to PDF
1512
using DocIORenderer docIORenderer = new DocIORenderer();
1613
// Create new DocIORenderer settings
1714
docIORenderer.Settings = new DocIORendererSettings();
18-
// Set the PDF conformance level to PDF/A-1B for archival standard compliance
19-
docIORenderer.Settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
20-
// Set the chart rendering scaling mode to normal to preserve the aspect ratio of charts
21-
docIORenderer.Settings.ChartRenderingOptions.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Normal;
2215
// Open the input Word document from a file stream
2316
FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Input.docx"), FileMode.Open, FileAccess.Read);
2417
// Load the Word document into a WordDocument instance
@@ -32,7 +25,9 @@
3225
// Save the generated PDF to the specified file stream
3326
pdf.Save(outputStream);
3427

35-
28+
/// <summary>
29+
/// Replaces Excel OLE objects in a Word document with images, preserving their original dimensions.
30+
/// </summary>
3631
void ReplaceExcelToImage(WordDocument wordDocument)
3732
{
3833
//Get the Ole objects.

0 commit comments

Comments
 (0)