用于高级文档处理的SDK

100%与Microsoft Office格式兼容

这是什么?

强大的文本、电子表格、演示文稿和PDF生成工具。
ONLYOFFICE文档生成器是支持您的应用软件修改或创建DOCX、XLSX、PPTX或PDF格式文档的最全面工具之一,且无需运行Microsoft Office。
在线演示

双许可证模式

ONLYOFFICE文档生成器附带双许可证模式。这意味着只要您遵循GNU AGPL v.3许可证,就可以使用GitHub上提供的ONLYOFFICE开源解决方案。为了保护您的知识产权和获取专业支持,您必须拥有Commercial License。
联系销售

ONLYOFFICE文档生成器有哪些特点?

通过ONLYOFFICE文本生成器,您可以为每一个文档创建简单脚本,无论是新文件还是您需要打开并修改的旧文件。您再也无需像使用其他生成器一样,在每次更改时都编译应用程序。开始动态生成您的文档!
阅读文档

ONLYOFFICE文档生成器功能

高级文档处理
插入格式化的文本、段落、图像、表格和图表、形状、页眉和页脚、创建项目符号或编号列表等。使用数据库中的数据填充表格。
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph, oRun, oDrawing, oTextPr;
oParagraph = oDocument.GetElement(0);
oDrawing = Api.CreateImage("https://www.onlyoffice.com/images/landing/document-builder/document.jpg", 1556 * 3600, 1044 * 3600);
oParagraph.AddDrawing(oDrawing);
oTextPr = oDocument.GetDefaultTextPr();
oTextPr.SetFontSize(24);
oTextPr.SetColor(64,64,64);
oParagraph = Api.CreateParagraph();
oRun = Api.CreateRun();
oRun.SetFontSize(36);
oRun.SetColor(0,112,192);
oRun.SetBold(true);
oRun.AddText("Advanced document processing,");
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oRun = Api.CreateRun();
oRun.SetFontSize(24);
oRun.SetColor(0,176,240);
oRun.SetBold(true);
oRun.AddText("Insert formatted text");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(",  paragraphs, ");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.SetFontSize(24);
oRun.SetColor(8,140,68);
oRun.SetBold(true);
oRun.SetUnderline(true);
oRun.AddText("images");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(", tables and ");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.SetFontSize(24);
oRun.SetColor(255,106,0);
oRun.SetBold(true);
oRun.SetItalic(true);
oRun.AddText("charts, ");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.SetHighlight(255,255,0);
oRun.AddText("shapes");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(", ");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.SetItalic(true);
oRun.SetVertAlign("superscript");
oRun.SetFontSize(40);
oRun.AddText("headers");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(", and ");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.SetItalic(true);
oRun.SetVertAlign("subscript");
oRun.SetFontSize(40);
oRun.AddText("footers");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.AddText(", create a bulleted or numbered list, etc. Populate a table using data from a database.");
oParagraph.AddElement(oRun);
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oRun = Api.CreateRun();
oRun.SetFontSize(18);
oRun.AddText("Best regards,");
oRun.AddLineBreak();
oRun.AddText("ONLYOFFICE Document Builder Team");
oParagraph.AddElement(oRun);
oDocument.Push(oParagraph);
for(var i=0; i<6; i++) {
    oParagraph = Api.CreateParagraph();
    oDocument.Push(oParagraph);
}
oParagraph = Api.CreateParagraph();
var oFill = Api.CreateSolidFill(Api.CreateRGBColor(217,217,217));
var oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oDrawing = Api.CreateShape("rect", 1568 * 3600, 9000, oFill, oStroke);
oParagraph.AddDrawing(oDrawing);
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oFill = Api.CreateSolidFill(Api.CreateRGBColor(230,156,164));
oStroke = Api.CreateStroke(0, Api.CreateNoFill());
oDrawing = Api.CreateShape("heart", 69 * 3600, 58 * 3600, oFill, oStroke);
oDrawing.SetWrappingStyle("square");
oDrawing.SetVerAlign("paragraph", "center");
oParagraph.AddDrawing(oDrawing);
oRun = Api.CreateRun();
oRun.SetFontSize(22);
oRun.AddText("   Have a question? Contact sales at ");
oParagraph.AddElement(oRun);
oRun = Api.CreateRun();
oRun.SetFontSize(22);
oRun.SetColor(107,159,37);
oRun.SetUnderline(true);
oRun.AddText("sales@onlyoffice.com");
oParagraph.AddElement(oRun);
oDocument.Push(oParagraph);
builder.SaveFile("docx", "sampletext.docx");
builder.CloseFile();

ONLYOFFICE文档生成器背后的技术

ONLYOFFICE文档生成器提供一个JavaScript API,具有完善的文档记录,并且易于使用。从我们的库中选择适当的方法和类,或者选择常用的JavaScript方法更改某些元素格式设置属性。
阅读文档

无论您使用何种语言编写应用程序,文档生成器都可以与其相集成。

.Net (C# MVC) .Net (C#) Node.js PHP Ruby

有疑问?

通过sales@onlyoffice.com联系销售。