Free Support Forum - aspose.com

TabStops.Clear() doesn't work

Some sample but incomplete code:

DocumentBuilder builder = new DocumentBuilder(_document);
builder.MoveToDocumentStart();
builder.PageSetup.LeftMargin = ConvertUtil.InchToPoint(1.0d);
builder.PageSetup.TopMargin = ConvertUtil.InchToPoint(1.8d);
builder.PageSetup.BottomMargin = ConvertUtil.InchToPoint(0.9d);
builder.PageSetup.RightMargin = ConvertUtil.InchToPoint(1.0d);
builder.ParagraphFormat.TabStops.Clear();

builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.ParagraphFormat.TabStops.Clear();

I cannot get rid of ANY of the tabstops when calling the clear... I see the default tab stops still in the file. I notice that someone else had this issue with the Styles objects. I suspect it's related. How soon can something such as this be fixed? I tried Aspose.Words versions 6.2.0.0 and 8.0.0.0 for C# .NET. No luck.

Hello

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Could you please also attach your input document and expected output? I will investigate the issue and provide you more information.

Best regards,

Input is a new and empty microsoft word 2003 document. The output should have all tabstops in the header removed. There are 2 (center and right), just like with the input document.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. As I can see tab stops are defined in “Header” style, so if you need to remove these tab stops, you should remove them from this style. Please see the following code:

Document doc = new Document(@"Test001\in.doc");

Style headerStyle = doc.Styles["Header"];

headerStyle.ParagraphFormat.TabStops.Clear();

doc.Save(@"Test001\out.doc");

Hope this helps.

Best regards.

That works! I will say this, however… that was NOT the obvious workflow. Where are the default named styles documented?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. I think you are looking for StyleIdentifier enum: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net-and-java/aspose.words.styleidentifier.html

Hope this helps.

Best regards.