Thứ Năm, 5 tháng 1, 2017

Insert Excel Watermark using EPPlus

public static void AddWatermarkUsingHeaderFooterImage(OfficeOpenXml.ExcelWorksheet worksheet, System.Drawing.Image image)
{
 //Enable PageLayoutView mode to see the watermark
 worksheet.View.PageLayoutView = true;
 worksheet.HeaderFooter.EvenHeader.InsertPicture(image, PictureAlignment.Centered);
 worksheet.HeaderFooter.OddHeader.InsertPicture(image, PictureAlignment.Centered);
}
public static void AddWatermarkUsingBackgroundImage(OfficeOpenXml.ExcelWorksheet worksheet, System.Drawing.Image image)
{
  worksheet.BackgroundImage.Image = image;
}

Reference:
https://support.office.com/en-us/article/Add-a-watermark-in-Excel-a372182a-d733-484e-825c-18ddf3edf009
https://support.office.com/en-us/article/Add-or-remove-a-sheet-background-9f4bb31d-4538-465b-b5e3-214ff1b56ed7

Không có nhận xét nào :

Đăng nhận xét