CheckGrammarOptions.PreserveFormatting

CheckGrammarOptions PreserveFormatting property. Allows to specify whether preserve layout and formatting of the original document or not. Default value is true.

CheckGrammarOptions.PreserveFormatting property

Allows to specify whether preserve layout and formatting of the original document, or not. Default value is true.

public bool PreserveFormatting { get; set; }

Remarks

When the option is set to false, the quality of grammar checking is higher than when this option is set to true. However, the original formatting of the text is not preserved in this case.

Examples

Demonstrates how to check grammar in a document and save the result as an array of image streams.

string apiUrl = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_URL", EnvironmentVariableTarget.User);
string apiName = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_NAME", EnvironmentVariableTarget.User);
string apiKey = Environment.GetEnvironmentVariable("CUSTOM_OPENAI_KEY", EnvironmentVariableTarget.User);

AiModel model = OpenAiModel.Create(apiUrl, apiName, apiKey);
CheckGrammarOptions options = new CheckGrammarOptions() { PreserveFormatting = true };

Stream[] pages = GrammarChecker.CheckGrammarToImages(MyDir + "SimpleAI.docx", new ImageSaveOptions(SaveFormat.Png), model, options);

See Also