I’ve walked through our code with the debugger and extracted all the Aspose calls, and from that I’ve hacked together a test case that does reproduce the problem. The code follows:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Aspose.Words;
using Aspose.Words.Drawing;
using Aspose.Words.Tables;
using Aspose.Words.Lists;
namespace TestAsposeODTExport
{
class Program
{
static void Main(string[] args)
{
Document _toDoc = new Document();
_toDoc.BuiltInDocumentProperties.Title = "hello";
_toDoc.BuiltInDocumentProperties.Author = "me";
_toDoc.BuiltInDocumentProperties.Pages = 1;
_toDoc.BuiltInDocumentProperties.NameOfApplication = "foo";
_toDoc.RemoveAllChildren(); // removes default section
Section _section = new Section(_toDoc);
_section.ClearHeadersFooters();
_toDoc.AppendChild(_section);
Body body = new Body(_toDoc);
_section.AppendChild(body);
_section.PageSetup.LeftMargin = 72.0;
_section.PageSetup.TopMargin = 72.0;
_section.PageSetup.RightMargin = 72.0;
_section.PageSetup.BottomMargin = 72.0;
_section.PageSetup.PageWidth = 612.0;
_section.PageSetup.PageHeight = 792.0;
_section.PageSetup.HeaderDistance = 20.0;
_section.PageSetup.FooterDistance = 20.0;
addParagraph(_toDoc, body);
addTable(_toDoc, body);
addParagraph(_toDoc, body);
_toDoc.Save("c:\\temp\\test.odt", SaveFormat.Odt);
}
static void addParagraph(Document _toDoc, Body body)
{
Paragraph asposePara = new Paragraph(_toDoc);
asposePara.ParagraphFormat.FirstLineIndent = 0.0;
asposePara.ParagraphFormat.LeftIndent = 0.0;
asposePara.ParagraphFormat.RightIndent = 0.0;
TabStop stop = new TabStop(36.0);
stop.Alignment = TabAlignment.Left;
asposePara.ParagraphFormat.TabStops.Add(stop);
asposePara.ParagraphFormat.Alignment = ParagraphAlignment.Left;
asposePara.ParagraphFormat.LineSpacing = 12.0;
asposePara.ParagraphFormat.SpaceAfter = 0.0;
asposePara.ParagraphFormat.SpaceBefore = 0.0;
body.AppendChild(asposePara);
Run asposeRun = new Run(_toDoc, "");
asposeRun.Font.Name = "Times New Roman";
asposeRun.Font.Size = 12.0;
asposePara.AppendChild(asposeRun);
}
static void addTable(Document _toDoc, Body body)
{
Table asposeTable = new Table(_toDoc);
((CompositeNode)body).AppendChild(asposeTable);
Row row = new Row(_toDoc);
asposeTable.AppendChild(row);
Cell cell = new Cell(_toDoc);
row.AppendChild(cell);
cell.CellFormat.Width = 10.0;
cell.CellFormat.Shading.BackgroundPatternColor = Color.FromArgb(0xff, Color.FromArgb(-16732372));
cell.CellFormat.Borders.LineStyle = LineStyle.None;
cell.CellFormat.Borders.Color = Color.FromArgb(0xff, Color.FromArgb(0));
cell.CellFormat.LeftPadding = 3.0;
cell.CellFormat.TopPadding = 3.0;
cell.CellFormat.RightPadding = 3.0;
cell.CellFormat.BottomPadding = 3.0;
Paragraph asposePara = new Paragraph(_toDoc);
asposePara.ParagraphFormat.FirstLineIndent = 0.0;
asposePara.ParagraphFormat.LeftIndent = 0.0;
asposePara.ParagraphFormat.RightIndent = 0.0;
asposePara.ParagraphFormat.Alignment = ParagraphAlignment.Left;
asposePara.ParagraphFormat.LineSpacing = 12.0;
asposePara.ParagraphFormat.SpaceAfter = 0.0;
asposePara.ParagraphFormat.SpaceBefore = 0.0;
cell.AppendChild(asposePara);
Run asposeRun = new Run(_toDoc, "");
asposeRun.Font.Name = "Times New Roman";
asposeRun.Font.Size = 12.0;
asposePara.AppendChild(asposeRun);
}
}
}