Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Watermark Image + Fix Heigh / Width for headers/footers #254

Open
PrzemyslawKlys opened this issue Sep 23, 2024 · 1 comment

Comments

@PrzemyslawKlys
Copy link
Member

PrzemyslawKlys commented Sep 23, 2024

When using:

public static void Watermark_SampleImage1(string folderPath, bool openWord) {
    Console.WriteLine("[*] Creating standard document with Watermark Image 1");
    var imagePaths = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "Images");
    string filePath = System.IO.Path.Combine(folderPath, "Basic Document with Watermark Image 1.docx");

    using (WordDocument document = WordDocument.Create(filePath)) {
        document.AddParagraph("Section 0");
        document.AddHeadersAndFooters();

        var imagePathToAdd = System.IO.Path.Combine(imagePaths, "PrzemyslawKlysAndKulkozaurr.jpg");
        var watermark = document.Sections[0].Header.Default.AddWatermark(WordWatermarkStyle.Image, imagePathToAdd);

        // TODO: Add handling for watermark image
        Console.WriteLine(watermark.Height);
        Console.WriteLine(watermark.Width);

        document.Save(false);
    }

    using (WordDocument document = WordDocument.Load(filePath)) {

        document.Save(openWord);
    }
}

The console lines throw an error since it only expects picture in document not headers/footers.

Console.WriteLine(watermark.Height);
Console.WriteLine(watermark.Width);

@PrzemyslawKlys
Copy link
Member Author

Linked PR:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant