I have an MVC3 C# .Net web app. I am using Aspose.Words to create an MS Word document. I have a requirement to not include tables in the document. However, on several lines of the document the alignment of the text is mis-aligned depending on the width of the text.
For example:
This looks good
Proposal Name: My Proposal Date:04/24/2012
This does not
Proposal Name: My Prop Date:04/24/2012
It should be
Proposal Name: My Prop Date:04/24/2012
Based on the width of the first bit of text, I need to calculate the width in pixels (I think) and insert a TAB if necessary.
Any ideas how to do this?
you can use Graphics.MeasureString function which gives you the width of your string in pixels based on your font. for more info go Here
Cheers,
Ehsan