Code Monkey home page Code Monkey logo

Comments (8)

PrzemyslawKlys avatar PrzemyslawKlys commented on September 25, 2024 1

Can be PR

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 25, 2024 1

AddParagraphAfterSelf is pretty useful AddParagraphBeforeSelf as well. Basically you can insert new paragraph before the one you're currently operating with. The ones with section isn't really useful i guess. But i could be wrong.

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 25, 2024

This is used internally:

public WordParagraph AddParagraph(bool newRun) {
var wordParagraph = new WordParagraph(_document, newParagraph: true, newRun: newRun);
if (this.Paragraphs.Count == 0) {
WordParagraph paragraph = this._document.AddParagraph(wordParagraph);
return paragraph;
} else {
WordParagraph lastParagraphWithinSection = this.Paragraphs.Last();
WordParagraph paragraph = lastParagraphWithinSection.AddParagraphAfterSelf(this, wordParagraph);
return paragraph;
}
}

and

public WordParagraph AddParagraph(string text = "") {
if (this.Paragraphs.Count == 0) {
WordParagraph paragraph = this._document.AddParagraph();
if (text != "") {
paragraph.Text = text;
}
return paragraph;
} else {
WordParagraph lastParagraphWithinSection = this.Paragraphs.Last();
WordParagraph paragraph = lastParagraphWithinSection.AddParagraphAfterSelf(this);
paragraph._document = this._document;
if (text != "") {
paragraph.Text = text;
}
return paragraph;
}
}

This could be hidden and made internal/private only. I don't think it doesn't make much sense outside of internal usage.

from officeimo.

tmheath avatar tmheath commented on September 25, 2024

Alright thanks, that answered this question.

Would you like me to change the scope of the
method to internal in next pr or leave as is?

from officeimo.

tmheath avatar tmheath commented on September 25, 2024

I also should update the signature for AddParagraphBeforeSelf then?

Making the change locally, will open a PR in the future.

from officeimo.

tmheath avatar tmheath commented on September 25, 2024

I've made the commit locally, let me know if AddParagraphBeforeSelf shouldn't be made private.

from officeimo.

PrzemyslawKlys avatar PrzemyslawKlys commented on September 25, 2024

If it has section then yes. But otherwise no

from officeimo.

tmheath avatar tmheath commented on September 25, 2024

BeforeSelf does not have a section argument, but an overload for AfterSelf does. I only need to make the definition with section as an argument private and leave both other method's defined public?

Private: AddParagraphAfterSelf(WordSection section, WordParagraph paragraph = null);
Public: AddParagraphAfterSelf();
public AddParagraphBeforeSelf();

Asking for clarification, right now I moved all three to the private methods file.

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.