Free Support Forum - aspose.com

Borders missing from imported section

hello all:

i'm creating a "main" document from several sub-sections.

One of the subsections has a table in it, with cell borders turned on.

The border information is being set correctly in the fragment, because I can save the fragment to a separate document, and the borders show up there.

However, after I do

...

Aspose.Word.Section ImportedSection = (p.DocumentMain.ImportNode(SubSection, true) as Aspose.Word.Section);

DocumentMain.Sections.Add(ImportedSection);

...

the borders are missing in DocumentMain. Is this a known issue, or am I doing something wrong?

This works in our tests. Please attach your document here so we can test on it.

Well, i was wrong... the problem doesn't have to do with importing. The borders seems to get lost when saving a document to a client browser...

the following is in an aspx page. All it does is open a document, and add a cell with borders to it.

As written, the borders will not appear in the browser. However, the document saved to the file system shows the borders correctly. The borders also show correctly when the save format is HTML.

private void Page_Load(object sender, System.EventArgs e)

{

Document m_document;

DocumentBuilder m_builder;

m_document = new Document ("d:\\dev\\asposeTest\\test2\\blankDoc.doc");

m_builder = new DocumentBuilder(m_document);

m_builder.StartTable();

m_builder.CellFormat.Width = 100f;

m_builder.InsertCell();

m_builder.CellFormat.Borders[BorderType.Top].LineStyle = LineStyle.Single;

m_builder.CellFormat.Borders[BorderType.Bottom].LineStyle = LineStyle.Single;

m_builder.CellFormat.Borders[BorderType.Left].LineStyle = LineStyle.Single;

m_builder.CellFormat.Borders[BorderType.Right].LineStyle = LineStyle.Single;

m_builder.Writeln("Row 1, Cell 1");

m_builder.EndRow();

m_builder.EndTable();

m_document.Save("d:\\dev\\asposeTest\\test2\\docOutput.doc");

//m_document.Save("EMS.doc", SaveFormat.FormatDocument

// , SaveType.OpenInBrowser, HttpContext.Current.Response);

m_document.Save("Document", SaveFormat.FormatHtml,

SaveType.OpenInBrowser, HttpContext.Current.Response);

}

Yes, table borders are not drawn when saving in HTML format. This issue will be fixed in one of the future releases.

Saving file with SaveFormat.FormatDocument, like

m_document.Save("Document.doc", SaveFormat.FormatDocument, SaveType.OpenInBrowser, HttpContext.Current.Response);

opens file in the browser with Word plug-in, and the borders are shown correctly. But don't forget to put the ".doc" extension to the file name to make the browser recognize MS Word document file type.

We have released a new version of Aspose.Words that contains a fix for your issue.

The new version of Aspose.Words is available for download from here.

Best regards.