feat(xlsx): REST + фронт + документация (шаг 8)
- ConvertController: расширение .xlsx, текст 400 «только .docx, .doc и .xlsx» (контракт с фронтом), @Operation — флаг errorOnSmartArt на .xlsx не срабатывает; safeBaseName срезает .xlsx - фронт: DropZone accept/подпись, подзаголовок App, api.ts фолбэк-имя режет .xlsx; web build+lint зелёные - app-тесты: xlsxFile_convertsToPdf (200, PDF, filename* Отчёт.pdf, текст доехал), nonDocxFilename_rejected — .xlsx в тексте, safeBaseName .XLSX - прод-автотест test_convert_xlsx (32 проверки) - docs: новая docs/agent/xlsx-bridge.md (классы, единицы, деградации, соглашения PrintLayout↔валидатора); AGENTS.md — роутинг входа, секция моста .xlsx, REST/фронт/счётчики (75 классов/1095 тестов, 32 фикстуры); pipeline.md (ContainerKind, estimateXlsxPages), repo-map.md (пакет, DocxPackageWriter, генераторы, пересоздание xlsx), testing.md, doc-bridge.md (DocxWriter → internal/DocxPackageWriter) Сквозная проверка java -jar + curl: xlsx→PDF 200 (filename* RFC5987), chart-fixture 200 с отрисованными PNG, errorOnCharts=true → 422 контрактный текст, .txt → 400 новый текст, .doc-регресс 200
This commit is contained in:
@@ -64,7 +64,9 @@ export async function convertDocx(
|
||||
// флаг i обязателен; фолбэк — имя исходника с заменой расширения
|
||||
const cd = resp.headers.get('Content-Disposition') ?? ''
|
||||
const m = /filename\*=utf-8''([^;]+)/i.exec(cd)
|
||||
const filename = m ? decodeURIComponent(m[1]) : file.name.replace(/\.docx?$/i, '') + '.pdf'
|
||||
const filename = m
|
||||
? decodeURIComponent(m[1])
|
||||
: file.name.replace(/\.(docx?|xlsx)$/i, '') + '.pdf'
|
||||
const blob = await resp.blob()
|
||||
return { blob, filename }
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ export default function App() {
|
||||
<div>
|
||||
<h1 className="text-2xl font-semibold">Word → PDF</h1>
|
||||
<p className="mt-1 text-sm text-muted">
|
||||
docx/doc → PDF на docx4j + Apache FOP. Лимиты задаёт сервер;
|
||||
docx/doc/xlsx → PDF на docx4j + Apache FOP. Лимиты задаёт сервер;
|
||||
переопределение из формы убрано.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@ interface Props {
|
||||
}
|
||||
|
||||
/**
|
||||
* Зона drag&drop + клик для выбора .docx/.doc. Скрытый input[type=file] —
|
||||
* Зона drag&drop + клик для выбора .docx/.doc/.xlsx. Скрытый input[type=file] —
|
||||
* единственный источник выбора; drop берёт первый файл.
|
||||
*/
|
||||
export default function DropZone({ file, disabled, onSelect }: Props) {
|
||||
@@ -53,7 +53,7 @@ export default function DropZone({ file, disabled, onSelect }: Props) {
|
||||
<path d="M12 16V4m0 0-4 4m4-4 4 4" />
|
||||
<path d="M4 16v3a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3" />
|
||||
</svg>
|
||||
<span>Перетащите .docx или .doc сюда или нажмите для выбора</span>
|
||||
<span>Перетащите .docx, .doc или .xlsx сюда или нажмите для выбора</span>
|
||||
{file && (
|
||||
<span className="text-sm text-muted">
|
||||
{file.name} · {(file.size / 1024).toFixed(0)} КБ
|
||||
@@ -62,7 +62,7 @@ export default function DropZone({ file, disabled, onSelect }: Props) {
|
||||
<input
|
||||
ref={inputRef}
|
||||
type="file"
|
||||
accept=".docx,.doc"
|
||||
accept=".docx,.doc,.xlsx"
|
||||
className="sr-only"
|
||||
disabled={disabled}
|
||||
onChange={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user