Hi,
Thanks for your description and your document, it's clear.
You can get the start number from para.ListFormat.CurrentListLevel.StartAt, we provide you some code
- Code: Select all
String inputFile = GetInputFile(@"SALESSUPPORT-1467\HV_ausgezeichnet_mit_Logo.rtf");
Document doc = new Document();
doc.LoadRtf(inputFile, Encoding.UTF8);
Dictionary<String, int> listNumber = new Dictionary<string, int>();
foreach (Section sec in doc.Sections)
{
foreach (Paragraph p in sec.Paragraphs)
{
ListFormat format = p.ListFormat;
if (format != null && format.CurrentListLevel != null
&& format.CurrentListLevel.PatternType != ListPatternType.Bullet)
{
int number = 1;
if (listNumber.ContainsKey(format.CustomStyleName))
{
number = listNumber[format.CustomStyleName] + 1;
}
else
{
number = format.CurrentListLevel.StartAt;
}
listNumber[format.CustomStyleName] = number;
Console.Write("{0}. ", number);
}
Console.WriteLine(p.Text);
}
}
Some paragraphs have the list with number UpLetter or UpLetter), you could get the indicator from CurrentListLevel.PatternType and more information, for example number format of number text, from the object CurrentListLevel.
If you have any other question, please tell us.
Regards,