Thanks for the additional information. Please find attached a Word document containing the results produced by your code on my side.
Could you please also double check if you are using the latest version (11.11.0)? You can dynamically check if you’re referencing the correct DLL by using the following code snippet:
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (System.Reflection.Assembly assembly in assemblies)
{
System.Reflection.AssemblyName assemblyName = assembly.GetName();
if (assemblyName.Name.Contains("Aspose.Words"))
Console.WriteLine("Aspose.Words Version Number: " + assemblyName.Version.ToString());
}
If we can help you with anything else, please feel free to ask.
I test it with the same Demo.doc file.The attachment is my test solution.
platform : .net 4.0 vs2010
windows server 2003(Simplified Chinese)
aspose.word.dll(11.11.0.0)
office 2007(Simplified Chinese)
It is nothing different between my twice test results.
my code:
–>>
public static void GetNavigationMapInfo()
{
Document doc = new Document(strFilePath);
DocumentBuilder dbuilder = new DocumentBuilder(doc);
// print the version of aspose.word.dll
System.Reflection.Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (System.Reflection.Assembly assembly in assemblies)
{
System.Reflection.AssemblyName assemblyName = assembly.GetName();
if (assemblyName.Name.Contains("Aspose.Words"))
{
Console.WriteLine("Aspose.Words Version Number: " + assemblyName.Version.ToString());
Console.WriteLine();
Console.WriteLine();
}
}
// iterate all sections
int i = 0;
foreach (Section sec in doc.Sections)
{
Console.WriteLine("section:{0}", i);
i++;
Console.WriteLine("PageStartingNumber:" + sec.PageSetup.PageStartingNumber.ToString());
Console.WriteLine("sec.PageSetup.PageStartingNumber:" + sec.PageSetup.PageNumberStyle.ToString());
Console.WriteLine("sec.PageSetup.RestartPageNumbering:" + sec.PageSetup.RestartPageNumbering.ToString());
Console.WriteLine("sec.PageSetup.PageNumberStyle:" + sec.PageSetup.PageNumberStyle.ToString());
Console.WriteLine();
Console.WriteLine();
}
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
foreach (Paragraph parag in paragraphs)
{
if (
// (true == parag.ParagraphFormat.Style.BuiltIn)
// &&
(true == parag.ParagraphFormat.StyleName.StartsWith("标题 "))
||
(true == parag.ParagraphFormat.StyleName.StartsWith("Heading")))
{
Console.WriteLine("parag Text:" + parag.Range.Text);
Console.WriteLine("parag OutlineLevel:" + parag.ParagraphFormat.OutlineLevel.ToString());
PageNumberFinder finder = new PageNumberFinder(doc);
int pageNum = finder.GetPage(parag.Runs[0]);
int pageNodeEnd = finder.GetPageEnd(parag);
Console.WriteLine("parag page number:" + pageNum.ToString());
Console.WriteLine("parag end page number:" + pageNodeEnd.ToString());
Console.WriteLine();
Console.WriteLine();
}
}
return;
}
test result:
–>> Aspose.Words Version Number: 11.11.0.0
Thanks for the additional information. Please ensure you have set the license as described in the instructions here before instantiating the Document object. Moreover, I have attached a sample application here for your reference; you can run this application to verify that running Aspose.Words with a valid license set produces correct results. I hope, this helps.
Thanks for your inquiry. I suppose you should just call Document.UpdateListLabels method to update list label properties such as LabelValue and LabelString for each ListLabel object in the document. Secondly, to get the value of a list item you can use the ListLabel class and the ListLabel.LabelValue member. I hope, this helps.
Thanks for your inquiry. I suppose you should just call Document.UpdateListLabels method to update list label properties such as LabelValue and LabelString for each ListLabel object in the document. Secondly, to get the value of a list item you can use the ListLabel class and the ListLabel.LabelValue member. I hope, this helps.
Best regards,*
Should I use ListLable.LableString instead of ListLable.LableValue? for example, when the list number is 3.3, ListLable.LableValue will equal 3, but ListLable.LableString will equal 3.3(That is what I want.).
Please reach the colored lines below, and give me an advice.
Another question:
The bullet list nested in a arabic list. All these lists are headings.How can I get all these text?
Please open the attachements to get more infomation.
Thanks for your inquiry. LabelValue is used to get the position of the paragraph in current level of the list. If we have a list with multiple level then this will tell us what position it is on that particular level. I think, to display the complete paragraph text, you should just output the Paragraph node to text format as follows:
the phrase builder.Writeln(“parag Text:” + parag.ToString(SaveFormat.Text).Trim()); cant print bullet character into file.
I see some code like these:
—
level2.NumberFormat = “\xf0af”; // A bullet that looks like some sort of a star.
or
level2.NumberFormat = ChrW(&Hf0af).ToString() ’ A bullet that looks like some sort of a star.
—
question: where can I get definition of these codes like “\xf0af”?
I find these codes from the manual with key word ListTemplate:
// Create a bulleted list based on one of the Microsoft Word list templates
// and apply it to the current paragraph in the document builder.
builder.ListFormat.List = doc.Lists.Add(ListTemplate.BulletDiamonds);
// There are 9 levels in this list, lets try them all.
for (int i = 0; i < 9; i++)
{
builder.ListFormat.ListLevelNumber = i;
builder.Writeln("Level " + i);
}
How can I get bullet character and print them into ms word? such as bulletdiamonds, and something like that.
Faces with the same issue (initial one), I need to get page number from nodes.
Please, could you provide the same workaround solution “PageFinder.zip” and PageNumbersTest.zip in java?
Thus, the proposed code is written in c#.
I’m using the getPage method of class PageFinder.
I’m encounter a memory issue in some case when using this workaround.
Caused by: java.lang.OutOfMemoryError: Java heap space
at asposewobfuscated.ëCW.ëzE(Unknown Source)
at com.aspose.words.ëF.ësP(Unknown Source)
at com.aspose.words.DocumentBuilder.ëj9(Unknown Source)
at com.aspose.words.DocumentBuilder.ëUX(Unknown Source)
at com.aspose.words.DocumentBuilder.ëX(Unknown Source)
at com.aspose.words.DocumentBuilder.insertField(Unknown Source)
at fr.aspose.words.pagefinderutility.PageFinder.insertFieldsAtInlineLevel(PageFinder.java:292)
at fr.aspose.words.pagefinderutility.PageFinder.findPageNumbersOfNodes(PageFinder.java:181)
at fr.aspose.words.pagefinderutility.PageFinder.checkHasFoundPageNumbers(PageFinder.java:549)
at fr.aspose.words.pagefinderutility.PageFinder.getPage(PageFinder.java:50)
Please, could you tell us if it exists now the same feature (getting the page number of a node) implemented in the last release of Aspose.Words or if it’s scheduled?
Thanks for your inquiry. Sure, Aspose.Words has introduced a new Layout namespace that provides classes allowing access to information such as on what page and where on a page particular document elements are positioned, when the document is formatted into pages.
For example, the LayoutCollector class collects mapping of document nodes to layout objects and computes page numbers of nodes.
When you create a LayoutCollector and specify a Document document object to attach to, the collector will record mapping of document nodes to layout objects when the document is formatted into pages.
You will be able to find out on which page a particular document node (e.g. run, paragraph or table cell) is located by using the GetStartPageIndex, GetEndPageIndex and GetNumPagesSpanned methods. These methods automatically build page layout model of the document and update fields if required.
Thank you very much for your help.
By using LayoutCollector class, I can find successfully page number of given node.
It solved my issue about “java.lang.OutOfMemoryError: Java heap space”.