41 lines
2.0 KiB
Plaintext
41 lines
2.0 KiB
Plaintext
|
|
#r "nuget: DocumentFormat.OpenXml, 3.2.0"
|
|||
|
|
|
|||
|
|
using DocumentFormat.OpenXml;
|
|||
|
|
using DocumentFormat.OpenXml.Packaging;
|
|||
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
|||
|
|
|
|||
|
|
string outputPath = "C:/Users/Administrator/Desktop/xxx/宫崎骏简介.docx";
|
|||
|
|
|
|||
|
|
using var doc = WordprocessingDocument.Create(outputPath, WordprocessingDocumentType.Document);
|
|||
|
|
var mainPart = doc.AddMainDocumentPart();
|
|||
|
|
mainPart.Document = new Document();
|
|||
|
|
var body = new Body();
|
|||
|
|
mainPart.Document.Append(body);
|
|||
|
|
|
|||
|
|
// Title
|
|||
|
|
var titlePara = new Paragraph(
|
|||
|
|
new ParagraphProperties(new ParagraphStyleId() { Val = "Title" }),
|
|||
|
|
new Run(new Text("宫崎骏简介"))
|
|||
|
|
);
|
|||
|
|
body.Append(titlePara);
|
|||
|
|
|
|||
|
|
// Content paragraph - 200 character introduction
|
|||
|
|
string content = "宫崎骏(Hayao Miyazaki),1941年1月5日出生于日本东京都,日本著名动画导演、漫画家及动画师,吉卜力工作室的核心人物。他以其独特的创作风格和深刻的环保主题闻名于世,代表作品包括《风之谷》《天空之城》《龙猫》《魔女宅急便》《红猪》《幽灵公主》《千与千寻》《哈尔的移动城堡》《悬崖上的金鱼姬》等。2003年,他执导的《千与千寻》荣获奥斯卡最佳动画长片奖,成为首位获得该奖项的非英语动画导演。宫崎骏的作品以细腻的情感、优美的画面和对自然与人类关系的深刻思考著称,倡导和平、环保和对儿童纯真心灵的守护,对全球动画产业产生了深远影响。";
|
|||
|
|
|
|||
|
|
var contentPara = new Paragraph(
|
|||
|
|
new ParagraphProperties(new SpacingBetweenLines() { After = "200" }),
|
|||
|
|
new Run(new Text(content))
|
|||
|
|
);
|
|||
|
|
body.Append(contentPara);
|
|||
|
|
|
|||
|
|
// Section properties (page setup)
|
|||
|
|
var sectPr = new SectionProperties(
|
|||
|
|
new PageSize() { Width = 12240, Height = 15840 }, // Letter size
|
|||
|
|
new PageMargin() { Top = 1440, Right = 1440, Bottom = 1440, Left = 1440 }
|
|||
|
|
);
|
|||
|
|
body.Append(sectPr);
|
|||
|
|
|
|||
|
|
mainPart.Document.Save();
|
|||
|
|
Console.WriteLine($"Created: {outputPath}");
|
|||
|
|
Console.WriteLine($"Content length: {content.Length} characters");
|