Comments (4)
PR was merged
public static void Example_BasicWordWithDefaultStyleChange(string folderPath, bool openWord) {
Console.WriteLine("[*] Creating standard document with different default style");
string filePath = System.IO.Path.Combine(folderPath, "BasicWordWithDefaultStyleChange.docx");
using (WordDocument document = WordDocument.Create(filePath)) {
document.Settings.FontSize = 30;
document.Settings.FontFamily = "Calibri Light";
document.Settings.Language = "pl-PL";
var paragraph1 = document.AddParagraph("To jest po polsku");
var paragraph2 = document.AddParagraph("Adding paragraph1 with some text and pressing ENTER");
paragraph2.FontSize = 15;
paragraph2.FontFamily = "Courier New";
document.Save(openWord);
}
}
Should be available in next version
from officeimo.
It's not exposed now, but I would suggest doing this differently. Just work without setting font family and then once everything is done just loop thru all paragraphs
foreach (var paragraph in document.Paragraphs) {
paragraph.SetFontFamily(...).SetFontSize(10)
}
You will fix this in 3 lines. I'll keep this open, as it should be possible to define default font/style.
from officeimo.
Não está exposto agora, mas eu sugeriria fazer isso de forma diferente. Basta trabalhar sem definir a família font e, em seguida, uma vez que tudo é feito apenas loop th através de todos os parágrafos
foreach (var paragraph in document.Paragraphs) { paragraph.SetFontFamily(...).SetFontSize(10) }Você vai consertar isso em 3 linhas. Vou manter isso aberto, pois deve ser possível definir fonte padrão/style.
Thanks, I thought I had a generic method, but so too solves my problem.
from officeimo.
I will add native way to do it in next release:
from officeimo.
Related Issues (20)
- Add Combo Chart HOT 1
- Upgrading DocumentFormat.OpenXML to version 3 HOT 1
- dotnet 8.0 error HOT 13
- Any way to implement numbered list (a., b., c., ....)? HOT 4
- Setting font size for list symbol HOT 7
- Any way to insert rich text HTML content? HOT 10
- Remove continue numbering & restart numbering for lists
- Add ability to merge & remove lists
- Image layout options HOT 8
- Mislabeled Behavior? HOT 8
- Potential Bug: Does iteration over TableCell's Paragraphs property allow mutation? HOT 21
- Stable and unlikely to change vs unstable and subject to change vs depreciated api HOT 13
- How to add paragraph without pagebreak? HOT 4
- ContentControls.Add() is trimming space from user selection HOT 1
- How to display the specific gravity value in a pie chart HOT 2
- How to add image watermark? HOT 3
- how can I add a table with two rows and each row had diff columns and width? HOT 1
- Issue with Text Replacement in Multi-Line Text Boxes HOT 1
- ConditionalFormattingFirstColumn sample HOT 2
- [Question] Does OfficeIMO provide support for HTML fragments? HOT 4
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.