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

Free Support Forum - aspose.com

How to set and get positioning of floating table using Java

Hello:
I want the table always positioned at the botoom of last page.but I can’t find how to set table’s postion.
I can use the code to set table’s textwrapping that is
"
Table tablefirst = (Table) doc.getChild(NodeType.TABLE, tableindex-1, true);|
tablefirst.setTextWrapping(TextWrapping.AROUND);
"
Then the question is How can I set tablefirst’s position? I see this code from example that is
"
if (tablefirst.getTextWrapping() == TextWrapping.AROUND) {
System.out.println(tablefirst.getRelativeVerticalAlignment());
}.
"
but how can I set tablefirst.setRelativeVerticalAlignment?

I hope your response! Thanks very much!

@o2oa2019

Unfortunately, Aspose.Words does not support the requested feature at the moment. However, we have already logged this feature request as WORDSNET-12204 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

Thanks for your reply and I will trace it.
Are there any ways that can solve this problem?
I tried builder.writeln() befor the table if doc.getPageCount() add one.But I used doc.getPageCount() to get doc’s current total page. It couldn’t change?
Hope your tip!Thanks Again!

@o2oa2019

Could you please ZIP and attach your input and expected output documents? We will then provide you more information about your query.

The issues you have found earlier (filed as WORDSNET-12204) have been fixed in this Aspose.Words for .NET 20.1 update and this Aspose.Words for Java 20.1 update.

Got it,Thanks!
But It isn’t effective still。

//定位到文档中最后一个表格
com.aspose.words.NodeCollection allTables = doc.getChildNodes(NodeType.TABLE, true);

  int tableindex = allTables.getCount();
  System.out.println("table count = "+tableindex);
  
  
  Table tablefirst = (Table) doc.getChild(NodeType.TABLE, tableindex-1, true);
  
  
  tablefirst.setTextWrapping(TextWrapping.AROUND);
  //确保表格不分页显示
  for (Cell cell : (Iterable<Cell>) tablefirst.getChildNodes(NodeType.CELL, true)) {
		// Call this method if table's cell is created on the fly
		// newly created cell does not have paragraph inside
		cell.ensureMinimum();
		for (Paragraph para : cell.getParagraphs())
			if (!(cell.getParentRow().isLastRow() && para.isEndOfCell()))
				para.getParagraphFormat().setKeepWithNext(true);
	}
	
  if (tablefirst.getTextWrapping() == TextWrapping.AROUND) {
	  System.out.println("aign:"+tablefirst.getRelativeVerticalAlignment());
	  tablefirst.setRelativeHorizontalAlignment(2);
	  tablefirst.setRelativeVerticalAlignment(2);
  }

I imported aspose-words-20.1-jdk17.jar.

@o2oa2019

Could you please share some more detail about your requirement along with input document and expected output? We will then provide you more information about your query .