We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Part of the generated Word document's SPELLING not default to English- but French

When using the AsPose.Words to add the data to the document and click ‘Spelling & Grammar’, all of file check to English except one table default to French, here is the code to generate the table, I also appended the document and the spelling screenshot.

Can you help me to check what’ wrong with the code and hot to fix the default language to English?

Thanks,

builder.Writeln();
builder.StartTable();

// Row 1
builder.InsertCell();
builder.CellFormat.Shading.BackgroundPatternColor = Color.Gainsboro;
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 1.5;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.ParagraphFormat.SpaceBefore = 1;
builder.ParagraphFormat.SpaceAfter = 1;
builder.Write(" ");

builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.CellFormat.Shading.BackgroundPatternColor = Color.Transparent;
builder.Font.Name = "Arial";
builder.Font.Size = 11;
builder.Font.Bold = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("Inoculation:");

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write("Sampling:");

builder.EndRow();

// Row 2
builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 0;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.CellFormat.RightPadding = 5;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Start Date:");

builder.InsertCell();
builder.CellFormat.RightPadding = 0;
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write(Job.StartInoculationDateAsText);

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write(Job.StartSamplingDateAsText);

builder.EndRow();

// Row 3
builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 0;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.CellFormat.RightPadding = 5;
builder.Font.Bold = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Completion Date:");

builder.InsertCell();
builder.CellFormat.RightPadding = 0;
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write(Job.EndInoculationDateAsText);

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write(Job.EndSamplingDateAsText);

builder.EndRow();

// Row 4
builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 1.5;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1.5;
builder.Font.Bold = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write(" ");

builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("Job Completion Date:");

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write(Job.JobEndDateAsText);

builder.EndRow();

builder.EndTable();
builder.Writeln();
builder.StartTable();

// Row 1
builder.InsertCell();
builder.CellFormat.Shading.BackgroundPatternColor = Color.Gainsboro;
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 1.5;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.ParagraphFormat.SpaceBefore = 1;
builder.ParagraphFormat.SpaceAfter = 1;
builder.Write(" ");

builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.CellFormat.Shading.BackgroundPatternColor = Color.Transparent;
builder.Font.Name = "Arial";
builder.Font.Size = 11;
builder.Font.Bold = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("Inoculation:");

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write("Sampling:");

builder.EndRow();

// Row 2
builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 0;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.CellFormat.RightPadding = 5;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Start Date:");

builder.InsertCell();
builder.CellFormat.RightPadding = 0;
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write(Job.StartInoculationDateAsText);

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write(Job.StartSamplingDateAsText);

builder.EndRow();

// Row 3
builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 0;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.CellFormat.RightPadding = 5;
builder.Font.Bold = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Completion Date:");

builder.InsertCell();
builder.CellFormat.RightPadding = 0;
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.Font.Bold = false;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write(Job.EndInoculationDateAsText);

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write(Job.EndSamplingDateAsText);

builder.EndRow();

// Row 4
builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 1.5;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1.5;
builder.Font.Bold = true;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write(" ");

builder.InsertCell();
builder.CellFormat.Borders.Left.LineWidth = 0;
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("Job Completion Date:");

builder.InsertCell();
builder.CellFormat.Borders.Right.LineWidth = 1.5;
builder.Write(Job.JobEndDateAsText);

builder.EndRow();

builder.EndTable();

Hi Anna,

Thanks for your inquiry. I would suggest you read the following article and please try specifying Font.LocaleId before starting a new table:

https://reference.aspose.com/words/net/aspose.words/font/localeid/

Example code would be as follows:

DocumentBuilder builder = new DocumentBuilder();
builder.Writeln();
// builder.Font.LocaleId = 1036; // for French
builder.Font.LocaleId = 1033; // for English - United States
builder.StartTable();
// Row 1
builder.InsertCell();
builder.CellFormat.Shading.BackgroundPatternColor = Color.Gainsboro;
builder.CellFormat.Borders.Left.LineWidth = 1.5;
builder.CellFormat.Borders.Top.LineWidth = 1.5;
builder.CellFormat.Borders.Right.LineWidth = 1;
builder.CellFormat.Borders.Bottom.LineWidth = 1;
builder.ParagraphFormat.SpaceBefore = 1;
builder.ParagraphFormat.SpaceAfter = 1;
builder.Write(" ");
…
…

I hope, this will help.

Best Regards,

Thanks! It works!