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

Free Support Forum - aspose.com

Is there any way to condense font using .net code

I’ve attached a screenshot of steps that can condense the font in MS word.

Is there any way to achieve the same through .net Code using Apsose.word api.

Hi Prashant,


Thanks for your inquiry. Following code example shows how to use character scaling and spacing properties. Please use following highlighted code snippet to achieve your requirements.

// Create an empty document. It contains one empty
paragraph.
<o:p></o:p>

Document doc = new Document();

// Get the paragraph from the document, we will be adding runs of text to it.

Paragraph para = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);

// Add a run of text with characters 150% width of normal characters.

Run run = new Run(doc, "Wide characters");

run.Font.Scaling = 150;

para.AppendChild(run);

// Add a run of text with extra 1pt space between characters.

run = new Run(doc, "Expanded by 1pt");

run.Font.Spacing = 1;

para.AppendChild(run);

// Add a run of text with with space between characters reduced by 1pt.

run = new Run(doc, "Condensed by 1pt");

run.Font.Spacing = -1;

para.AppendChild(run);

doc.Save(MyDir + "Out.docx");