Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
UltraWebGridExcelExporter: Include an Image in Exported Spreadsheet?
posted

I'm exporting an UltraWebGrid to Excel using the Excel Exporter. It works great, but now my customer would like to insert the company logo onto the spreadsheet. Is there any way to do this? I've been looking through the docs and forums and haven't seen anything.

Thanks!
Scott

Parents
No Data
Reply
  • 10880
    Verified Answer
    posted

    Here is one way you can do this:

    Workbook wb = new Workbook();
    Worksheet ws=wb.Worksheets.Add("main");
    WorksheetImage wsi = new WorksheetImage(System.Drawing.Image.FromFile(MapPath("~/") + "16_excel.gif"));
    wsi.TopLeftCornerCell = ws.Rows[0].Cells[0];
    wsi.BottomRightCornerCell = ws.Rows[2].Cells[5];
    wsi.PositioningMode = ShapePositioningMode.DontMoveOrSizeWithCells;
    ws.Shapes.Add(wsi);
    UltraWebGridExcelExporter1.Export(UltraWebGrid1, ws, 10, 0);

    I create a workbook then a worksheet.  I then load an image then set some positioning properties.  You can also use the setBoundsInTwips method as well.  I add the image to my worksheet and then export my grid to that worksheet starting at the 10th row.

Children