HI,
Hi Yatin,
Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does.
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 about your query along with code.
Hi Yatin,
Thanks for your inquiry. In your case, I suggest you please convert the Excel sheet to image using Aspose.Cells and insert that image into Word document using DocumentBuilder.InsertImage method.
Workbook book = new Workbook(MyDir + “in.xlsx”);<o:p></o:p>
//Get the first worksheet.
Worksheet sheet = book.getWorksheets().get(0);
//To remove the white border around the image.
sheet.getPageSetup().setLeftMargin(0);
sheet.getPageSetup().setRightMargin(0);
sheet.getPageSetup().setTopMargin(0);
sheet.getPageSetup().setBottomMargin(0);
//Define ImageOrPrintOptions
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
imgOptions.setImageFormat(ImageFormat.getPng());
//Set only one page would be rendered for the image
imgOptions.setOnePagePerSheet(true);
imgOptions.setPrintingPage(PrintingPageType.IGNORE_BLANK);
//Create the SheetRender object based on the sheet with its
//ImageOrPrintOptions attributes
SheetRender render = new SheetRender(sheet, imgOptions);
render.toImage(0, MyDir + "Out.png");
//Aspose.Words code to insert image in the document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage(MyDir + "Out.png");
doc.save(MyDir + "Out.docx");