Comments (13)
Cool :-) Lets see how that WordTextBox goes first
from officeimo.
Well, how would you do it manually in Word to achieve what you want?
- Modify margins
- Add a table with hidden borders?
Both of that you can do. But maybe you are thinking on something else?
from officeimo.
In Word I would create a TextField:
And then I would place it at a specific location:
(Sorry, my Word is german, but I hope you recognize it).
Could this be added?
I'm not sure if a Table would do it, as I need multiple TextFields in e.g. the top region of a page - think of Sender-Address, Receiver-Address, Communication Info etc.
The basic problem is: those text fields need to be separate from the "normal" text run. They have to be at a specific location and should not interfere with the rest of the text.
from officeimo.
Looks like TextBox is drawing with anchor
Relative to a page
It's doable, but we need to add new type and all the properties to change different things. Alternate Content Fallback may be harder to do. But we will see.
from officeimo.
Is there anything where I can help? Unfortunately I have no clue what needs to be done - but this feature is critical for my app-idea, so I would be very happy to have this included.
Let me know if/how I may help!
from officeimo.
This looks similar to how you manage Images. So I will use WordImage type as a starting point and will have to create new type WordTextbox type or something similar. Hopefully it will be enough.
We will see from there.
from officeimo.
Awesome!
The project I'm working on should get to the market next year. As soon as I earn something with it I will give back to the projects I'm stacking on top like yours is!
from officeimo.
I got this thing working
internal static void Example_AddingTextbox2(string folderPath, bool openWord) {
Console.WriteLine("[*] Creating standard document with some textbox");
var filePath = System.IO.Path.Combine(folderPath, "BasicDocumentWithTextBox3.docx");
using (WordDocument document = WordDocument.Create(filePath)) {
var paragraph = document.AddParagraph("Adding paragraph with some text");
var textBox = document.AddTextBox("My textbox on the left");
textBox.HorizontalPositionRelativeFrom = HorizontalRelativePositionValues.Page;
// horizontal alignment overwrites the horizontal position offset so only one will work
textBox.HorizontalAlignment = HorizontalAlignmentValues.Left;
textBox.VerticalPositionOffsetCentimeters = 3;
var textBox2 = document.AddTextBox("My textbox on the right");
textBox2.HorizontalPositionRelativeFrom = HorizontalRelativePositionValues.Page;
textBox2.WordParagraph.ParagraphAlignment = JustificationValues.Right;
// horizontal alignment overwrites the horizontal position offset so only one will work
textBox2.HorizontalAlignment = HorizontalAlignmentValues.Right;
textBox2.VerticalPositionOffsetCentimeters = 3;
Console.WriteLine(textBox.VerticalPositionOffsetCentimeters);
Console.WriteLine(document.TextBoxes[0].VerticalPositionOffsetCentimeters);
Console.WriteLine(document.TextBoxes[1].VerticalPositionOffsetCentimeters);
document.Save(openWord);
}
}
But need to add some tests and probably there will be things that are going to need improvements. Maybe add some styles that are available in Word. Also the object is very complicated so I am not sure if it will survive testing on real world documents created by other people.
from officeimo.
Looks awesome! Exactly what I need! Would love to test this out!
from officeimo.
There is PR linked to this issue. You can play with it
from officeimo.
Oh right! Was on my mobile phone and did not realize it. Will try asap!
from officeimo.
As mentioned in the PR: it works and is exactly what I need! Would love to see it merged. :)
Thank you!
from officeimo.
Well that was an easy part. Now the "tests" needs to be done which is less than exciting ;p
from officeimo.
Related Issues (20)
- Strong naming HOT 5
- Add Paragraph Image from Project Resources HOT 1
- Several Fields in one Paragraph HOT 3
- Get Footnotes from Document HOT 10
- How to align page number in Footer HOT 7
- Is any possibility to add Hyperlink inside table cell ? HOT 2
- Document properties are not set when saving to Stream HOT 3
- mathematical formulas HOT 1
- Blank protection password not accepted when trying to unprotect generated word document HOT 4
- Insert image with fixed position HOT 6
- Add 3D Charts HOT 1
- Color applied to first paragraph in header/footer ignored HOT 7
- How to reset page numbers in a new section HOT 1
- Make the FindAndReplace(List<WordParagraph> ... ) method public HOT 1
- Inserting Tables HOT 1
- Documentation for attribute WordParagraph.underline links to MSDN HOT 5
- [Bug]Do Table Cells support adding images? HOT 7
- [Potential Bug] Paragraph AddText Method sets given text to the current run before adding the paragraph. HOT 4
- Horizontal Merge Weird Behaviour HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from officeimo.