Format Conversion
一键设置纸张、边距、缩放、重复标题行和页眉页脚
用三种语言从你的代码中调用此工具。
# 1) Upload each file first → returns { filePath }
curl -X POST 'https://api.elysiatools.com/upload/xlsx-print-setup-pack' \
-F 'file=@/path/to/workbookFile.ext'
# 2) Call the tool with the returned filePath values
curl -X POST 'https://api.elysiatools.com/zh/api/tools/xlsx-print-setup-pack' \
-F 'workbookFile=/public/samples/xlsx/finance-source.xlsx' \
-F 'sheetNames=Sheet1,Sheet2 (blank = all sheets)' \
-F 'paperSize=a4' \
-F 'orientation=landscape' \
-F 'marginsJson={
"top": 0.5,
"bottom": 0.45,
"left": 0.3,
"right": 0.3,
"header": 0.2,
"footer": 0.2
}' \
-F 'scalePercent=100' \
-F 'fitToWidth=1' \
-F 'fitToHeight=0' \
-F 'repeatTitleRows=1:2' \
-F 'repeatTitleColumns=A:B' \
-F 'printArea=A1:H60' \
-F 'headerText=&LFinance Pack&CQ1 Summary&RPage &P of &N' \
-F 'footerText=&LInternal Use Only&R&D' \
-F 'horizontalCentered=false' \
-F 'verticalCentered=false' \
-F 'showGridLines=false'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/xlsx-print-setup-pack| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| workbookFile | file需先上传 | 是 | — |
| sheetNames | text | 否 | — |
| paperSize | select | 否 | — |
| orientation | select | 否 | — |
| marginsJson | textarea | 否 | — |
| scalePercent | number | 否 | — |
| fitToWidth | number | 否 | — |
| fitToHeight | number | 否 | — |
| repeatTitleRows | text | 否 | — |
| repeatTitleColumns | text | 否 | — |
| printArea | text | 否 | — |
| headerText | text | 否 | — |
| footerText | text | 否 | — |
| horizontalCentered | checkbox | 否 | — |
| verticalCentered | checkbox | 否 | — |
| showGridLines | checkbox | 否 | — |
文件结果
{
"filePath": "/public/processing/randomid.ext",
"fileName": "output.ext",
"contentType": "application/octet-stream",
"size": 1024,
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
将以下内容加入你的 MCP 客户端配置:
{
"mcpServers": {
"elysiatools-xlsx-print-setup-pack": {
"name": "xlsx-print-setup-pack",
"description": "一键设置纸张、边距、缩放、重复标题行和页眉页脚",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=xlsx-print-setup-pack",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}连接到 SSE 端点后,列出已开放的工具:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}通过工具 id 调用,参数由其参数表构建:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "xlsx-print-setup-pack",
"arguments": {
"workbookFile": "/public/samples/xlsx/finance-source.xlsx",
"sheetNames": "Sheet1,Sheet2 (blank = all sheets)",
"paperSize": "a4",
"orientation": "landscape",
"marginsJson": "{\n \"top\": 0.5,\n \"bottom\": 0.45,\n \"left\": 0.3,\n \"right\": 0.3,\n \"header\": 0.2,\n \"footer\": 0.2\n}",
"scalePercent": 100,
"fitToWidth": 1,
"fitToHeight": 0,
"repeatTitleRows": "1:2",
"repeatTitleColumns": "A:B",
"printArea": "A1:H60",
"headerText": "&LFinance Pack&CQ1 Summary&RPage &P of &N",
"footerText": "&LInternal Use Only&R&D",
"horizontalCentered": false,
"verticalCentered": false,
"showGridLines": false
}
}
}有问题或反馈?请联系 [email protected]