File format is not correct wile creating the word doc using Aspose.Words

Hi Appaso,

In your case we suggest you please create a table and insert the images and charts in its cells. Hope this helps you.

Please manually create your expected Word document using Microsoft Word and attach it here for our reference. We will investigate how you want your final Word output be generated like. We will then provide you more information on this along with code.

Please find attached sample doc.

Hi Appaso,

Thanks sharing the detail. We suggest you please read following documentation links for your kind reference.

In your case we suggest you please create a table with two cells and one row. Each cell will have preferred width 50%. Insert the chart or table or any other contents inside each cell and removes the table’s border. Please check the following C# code example. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// We call this method to start building the table.
Table table = builder.StartTable();

Cell cell = builder.InsertCell();
cell.CellFormat.PreferredWidth = PreferredWidth.FromPercent(50);

//Insert Chart
// Add chart with default data. You can specify different chart types and sizes.
Shape chart1 = builder.InsertChart(ChartType.Column, 432, 252);

// Chart property of Shape contains all chart related options.
Chart chart = chart1.Chart;

// Get chart series collection.
ChartSeriesCollection seriesColl = chart.Series;

// Check series count.
Console.WriteLine(seriesColl.Count);

// Delete default generated series.
seriesColl.Clear();

// Create category names array, in this example we have two categories.
string[] categories = new string[] { "AW Category 1", "AW Category 2" };

// Adding new series. Please note, data arrays must not be empty and arrays must be the same size.
seriesColl.Add("AW Series 1", categories, new double[] { 1, 2 });
seriesColl.Add("AW Series 2", categories, new double[] { 3, 4 });
seriesColl.Add("AW Series 3", categories, new double[] { 5, 6 });
seriesColl.Add("AW Series 4", categories, new double[] { 7, 8 });
seriesColl.Add("AW Series 5", categories, new double[] { 9, 10 });

chart1.Width = 200;
chart1.Height = 200;

// Build the second cell
cell = builder.InsertCell();
cell.CellFormat.PreferredWidth = PreferredWidth.FromPercent(50);

//insert second chart.
Shape chart2 = builder.InsertChart(ChartType.Line, 432, 252);
Chart Linechart = chart2.Chart;

// Determines whether the title shall be shown for this chart. Default is true.
Linechart.Title.Show = true;

// Setting chart Title.
Linechart.Title.Text = "Sample Line Chart Title";

// Determines whether other chart elements shall be allowed to overlap title.
Linechart.Title.Overlay = false;

// Please note if null or empty value is specified as title text, auto generated title will be shown.
// Determines how legend shall be shown for this chart.
Linechart.Legend.Position = LegendPosition.Left;
Linechart.Legend.Overlay = true;

chart2.Width = 200;
chart2.Height = 200;

// Call the following method to end the row and start a new row.
builder.EndRow();

// Signal that we have finished building the table.
builder.EndTable();

table.ClearBorders();

doc.Save(MyDir + "Out v16.8.0.docx");
Hi Tahir,
We have changed our approch. Instead of converting PDF to word, we are doing excel to word.
We have converted doc file from excel file using ConverterXls2Doc from Aspose.Cells and Apose.Words. The issue we are facing is that when we are having image in workbook (same excel file like pdf in above example) and some text below that image or text in next cells. Then at the time of conversion, text is going in back side of image and not visible. We have to delete the image from doc file then we can see the text. Then we have to manually adjust the text position. Can you please suggest on this.
Thank you
Hi Appaso,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Excel document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we'll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.