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

Free Support Forum - aspose.com

Header styles missing :

Hi
I am trying to convert a doc containing (3 Column header) into html using Aspose.Word.java latest version. In html i am getting the header content as congested .

Here is my code.

import java.io.;
import com.aspose.words.
;
class header{
public static void main(String args[]){
StringBuilder hString=new StringBuilder();
int size=0;
try{
Document aDoc = new Document(“header.docx”);
ByteArrayOutputStream bout =null;
NodeCollection nodes = aDoc.getChildNodes(NodeType.HEADER_FOOTER, true);
if(nodes.getCount()>0)
{
for(int i=0;i<nodes.getCount();i++)
{
System.out.println(“INSIDE”);
com.aspose.words.Node node=nodes.get(i);
HeaderFooter headerFooter = (HeaderFooter)node;
Document tempDoc = new Document();
Body body =tempDoc.getFirstSection().getBody();

if (headerFooter.getStoryType() == StoryType.PRIMARY_HEADER){
NodeCollection hfChildren = headerFooter.getChildNodes();
for(int j=0;j<hfChildren.getCount();j++)
{
com.aspose.words.Node headerChild=hfChildren.get(j);
com.aspose.words.Node dstNode = tempDoc.importNode(
headerChild, true,
ImportFormatMode.KEEP_SOURCE_FORMATTING);
size+=dstNode.getText().length();
body.appendChild(dstNode);
}
if (body.getFirstChild() != null &&
body.getFirstChild().getText().trim().length() == 0){

body.getFirstChild().remove();
if(size>1){
bout = new ByteArrayOutputStream();
tempDoc.save(bout, SaveFormat.HTML);
hString=new StringBuilder(new String(bout.toByteArray()));
}

}
}
System.out.println(“HEADER CONTENT ::::”+hString);
}
}
catch(Exception e){

e.printStackTrace();
}
}



I have attached docx with this . Am i doing anything wrong ? Is there any other way to take header with styles? Please help me.

Regards,
Anbu.S





Hi

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

Thank you for reporting this problem to us. I managed to reproduce it on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

As a workaround, you can use table with 3 columns instead of tabs.

Best regards,

The issues you have found earlier (filed as WORDSNET-2932) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(60)