47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System.Data;
|
|
using System.Drawing;
|
|
using Aspose.Words;
|
|
using Aspose.Words.Drawing;
|
|
using Kreta.BusinessLogic.Classes.AsposeHelpers;
|
|
|
|
namespace Kreta.BusinessLogic.Helpers
|
|
{
|
|
public partial class AsposeHelper
|
|
{
|
|
private readonly DataSet _ds;
|
|
private readonly AsposeHelperOptions options;
|
|
private const string PAGE_BREAK_HTML = @"<div class=""pagebreak"">
|
|
|
|
</div>";
|
|
|
|
/// <summary>
|
|
/// Csak hogy le lehessen kérni a metódusokat.
|
|
/// </summary>
|
|
public AsposeHelper()
|
|
{
|
|
|
|
}
|
|
|
|
public AsposeHelper(DataSet ds, AsposeHelperOptions options)
|
|
{
|
|
_ds = ds;
|
|
this.options = options;
|
|
}
|
|
|
|
private static void SetCustomHeaderOnDocument(Document resultDoc, Image fejlecImage)
|
|
{
|
|
if (fejlecImage == null)
|
|
{
|
|
return;
|
|
}
|
|
var pageSetup = resultDoc.Sections[0].PageSetup;
|
|
var header = resultDoc.Sections[0].HeadersFooters[HeaderFooterType.HeaderPrimary];
|
|
var shape = new Shape(resultDoc, ShapeType.Image);
|
|
shape.ImageData.SetImage(fejlecImage);
|
|
shape.Width = pageSetup.PageWidth - pageSetup.LeftMargin - pageSetup.RightMargin;
|
|
header.Paragraphs[0].RemoveAllChildren();
|
|
header.Paragraphs[0].AppendChild(shape);
|
|
pageSetup.TopMargin = (shape.Width / fejlecImage.Width * fejlecImage.Height) + pageSetup.HeaderDistance;
|
|
}
|
|
}
|
|
}
|