I create an workbook
Document doc = new Document();
var builder = new DocumentBuilder(doc);
Workbook workbook = new Workbook();
int i = workbook.Worksheets.Add();
Worksheet sheet = workbook.Worksheets[i];
and then create my cells and then an insert it to my document by insertOleObject
method:
MemoryStream memorystream = new MemoryStream();
workbook.Save(memorystream, Aspose.Cells.SaveFormat.Xlsx);
byte[] bytes = memorystream.ToArray();
Shape oleObject = builder.InsertOleObject(memorystream, "Excel.Sheet.2", false, null);
I want worksheet that i build in workbook can be shown as a table but that does not happen.
I modify code as shakeel said in comment of his Answer And I accomplish :
MemoryStream memorystream = new MemoryStream();
workbook.Save(memorystream, Aspose.Cells.SaveFormat.Xlsx);
byte[] bytes = memorystream.ToArray();
memorystream.Position = 0;
// Apply different Image and Print options
var options = new Aspose.Cells.Rendering.ImageOrPrintOptions
{
HorizontalResolution = 200,
VerticalResolution = 200
};
// Set Horizontal Resolution
// Set Vertical Resolution
var sr = new SheetRender(sheet, options);
MemoryStream imageStream = new MemoryStream();
sr.ToImage(0, imageStream);
System.Drawing.Image image = Image.FromStream(imageStream);
Shape oleObject = builder.InsertOleObject(memorystream, "Excel.Sheet.12", false, image);