Free Support Forum -

Aspose formatting issues

Hello - I am trying to automate a document (see MNAOF attached) using Aspose by replacing bookmarks with content from C#. There are several issues with formatting as you can see in the second attachment (word2007)

1) The bitmap graph is not very clear

2) The pie-chart with legends become too small (can we mimic Excel pie chart as in the first attachment without any lines to the legends)

3) the starttable().. insertcell() just default to non usuable widths. I need to autosize it to the max size of the content

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

Thanks for your request. Could you please reattach your first document? Also please provide me your code. To attach multiple files to one post you can archive them with zip or rar.

Best regards.

Hello for the chart - i create the chart (or graph) and use


for table, i use


foreach(datarow arow in atable.rows)

for(int j=0; j < atable.columns.count;j++){






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

Thanks for additional information.

1. I can’t reproduce issue with cells width on my side. I used the following code for testing and it seems that all works fine.

Document doc = new Document(@"Test063\MNAOF.doc");

DocumentBuilder builder = new DocumentBuilder(doc);



foreach (DataRow arow in atable.Rows)


for (int j = 0; j < atable.Columns.Count; j++)









Maybe I should use some template document. If so please attach this document.

2. Please tell me how you get the chart pictures? Are you using Aspose.Cells? please attach sample images and if needed the excel workbook.

Best regards.

1) The chart is created by aspose.chart

3) I am using the same code as you. It looks as though because I am inserting a cell within an existing MSWord table cell that the format is not working at all.

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

Thank you for additional information.

1. I think that I have found workaround for you. Please try using EMF picture format. For example try using the following simple code and you will see difference between images in the generated document.

//Create a sample chart.

Aspose.Chart.Chart lineChart = new Aspose.Chart.Chart();

lineChart.Height = 300;

lineChart.Width = 400;

Aspose.Chart.Series lineSeries = new Aspose.Chart.Series();

lineSeries.ChartType = Aspose.Chart.ChartType.Line;

lineSeries.Name = "Series";

lineSeries.DataPoints.Add(new Aspose.Chart.DataPoint(1, 1));

lineSeries.DataPoints.Add(new Aspose.Chart.DataPoint(2, 2));

lineSeries.DataPoints.Add(new Aspose.Chart.DataPoint(3, 3));

// Fill a series manually


//Save chatr in EMF format

MemoryStream ms = new MemoryStream();

lineChart.Save(ms, ImageFormat.Emf);

//Create new document

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Insert chart using GetChartImage method


//Insert chart as EMF


//Save document


2. Maybe you can achieve this without using tables. Please see he attached document and the following code.

DataTable atable = new DataTable();




DataRow row = atable.NewRow();

row[0] = "US$2.53";

row[1] = "£1.27";

row[2] = "€1.70";


Document doc = new Document(@"Test063\in.doc");

DocumentBuilder builder = new DocumentBuilder(doc);

//Move to cell

builder.MoveToCell(0, 0, 1, 0);

builder.Font.Color = Color.Black;

for (int j = 0; j < atable.Columns.Count; j++)


//Insert value


if (j != atable.Columns.Count - 1)


builder.Write(ControlChar.TabChar.ToString()); //Insert tab




I hope this could help you.

Best regards.

Sorry - it doesn’t help. The whole thing is unsuable.


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

It is strange. I was sure that tip regarding EMF format should help you. See screenshot.

Maybe you can change your template that would not use nested tables.

Best regards.