Code Monkey home page Code Monkey logo

Comments (10)

PrzemyslawKlys avatar PrzemyslawKlys commented on September 21, 2024 1

It's probably easier to add some support for it. Not sure if i will have time, but I'll play with it soon

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 21, 2024 1

As long as it works for you ;) My implementation is a bit more complex, but it just simplifies things.

using (WordDocument document = WordDocument.Load(filePath)) {
    foreach (var footNote in document.FootNotes) {
        foreach (var paragraph1 in footNote.Paragraphs) {
            if (paragraph1.IsHyperLink) {
                paragraph1.Hyperlink.Text = "xxx";
            }
        }
    }
}

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 21, 2024

I don't think it's currently supported. Neither are endnotes.

image

from officeimo.

A10s avatar A10s commented on September 21, 2024

thanks for the quick response

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 21, 2024

By not supported I mean they are not directly exposed in easy to use way - but with some effort you could get them. Probaby easier to add this functionality into officeimo for others to use.

from officeimo.

A10s avatar A10s commented on September 21, 2024

Can you make a small example, how I get the footnotes from the document? I currently need to replace all hyperlinks in a project, including those in footnotes.

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 21, 2024

@A10s while I am not done with the PR, maybe this is something that will get you started already. You can add, find foot notes and modify them for now. If you're willing to compile your own version it may be just what you need for now. I'll probably finish it in few days if i get enough time. End notes are not done either.

from officeimo.

A10s avatar A10s commented on September 21, 2024

Thanks for the answer. I've already found how to get to the footnotes and the hyperlinks they contain

from officeimo.

A10s avatar A10s commented on September 21, 2024

my code:

var doc=WordDocument.Load("test.docx");
var footnotesPart = doc._document.MainDocumentPart?.FootnotesPart;
if (footnotesPart != null)
   {
     var footnotes = footnotesPart.Footnotes.Elements<Footnote>();
     foreach (var f in footnotes)
        {
          var hyperlinks = f.Descendants<Hyperlink>();
               foreach (var hyp in hyperlinks)
                    {
                       var id=hyp.Id;
                       var hrs=footnotesPart .HyperlinkRelationships.Single(q => q.Id == id);
                       var uri= hrs.Uri;
                       ........
                    }
   }}

from officeimo.

A10s avatar A10s commented on September 21, 2024

Thank you for your support!

from officeimo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.