表格单元格作为复选框

表格单元格作为复选框

我们必须使用乳胶复制现有的 pdf 表格。

我发现这很有用: https://www.tug.org/applications/hyperref/manual.html

我必须复制的现有表格具有可点击的单元格。

参见图片: 在此处输入图片描述

我认为我需要将表格单元格设为 \CheckBox。

或者让 \CheckBox 填满整个表格单元格。

目前我尝试使用 \CheckBox 的属性,但没有成功。

\mbox{\CheckBox[borderwidth=0.1mm,name=tblWetCell,width=3mm,height=3mm]{}}&\CheckBox[width=1mm,height=1mm]{ }

这就是它目前的状态。

在此处输入图片描述

完整表格:

\begin{table}[!ht]
\begin{small}
\begin{tabular}{|l|l|l|l|l|l|l|}
\cline{3-7}
\multicolumn{1}{l}{Anz. sep. WC}        &\TextField[width=3cm,name=toilAmount]{}        &\multirow{3}{*}{\rotatebox{90}{\hfill wöchentlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill täglich }} & \multirow{3}{*}{\rotatebox{90}{\hfill monatl
ich }} & \multirow{3}{*}{\rotatebox{90}{\hfill bei Bedarf }} & \multirow{3}{*}{\rotatebox{90}{\hfill Zusatzarbeiten }} \\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{1}{l}{Anz. Nasszellen}     &\TextField[width=3cm,name=wetCellAmount]{}     &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\

\hline
\multicolumn{2}{|l|}{Nasszellen (Bad / Dusche / Toiletten)}&\mbox{\CheckBox[borderwidth=0.1mm,name=tblWetCell,width=3mm,height=3mm]{}}&\CheckBox[width=1mm,height=1mm]{ }& &            &                \\
\hline
\multicolumn{2}{|l|}{Abfalleimer in Küchenabfall leeren} & &         &           &            &                \\
\hline
\end{tabular}
\end{small}
\end{table}

完整文档

\documentclass[a4paper,10pt]{article}
\usepackage{amssymb} % needed for math
\usepackage{amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for german umlauts
\usepackage[ngerman]{babel} % this is needed for german umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[margin=1cm]{geometry} %layout
\usepackage{graphicx}   % to enable \resizebox for table sacling to \linewidth

% specifics
\usepackage{hyperref}  % this is needed for forms and links within the text
%\def\DefaultHeightofSubmit{12pt}
%\def\DefaultWidthofSubmit{2cm}
%\def\DefaultHeightofReset{12pt}
%\def\DefaultWidthofReset{2cm}
%\def\DefaultHeightofCheckBox{0.5\baselineskip}
%\def\DefaultWidthofCheckBox{0.5\baselineskip}
\usepackage{multirow}                           % for cells with multiple rows
\usepackage{graphicx}                           % needed for the tables
\usepackage{xcolor}                             % to make text in required color
\renewcommand{\familydefault}{\sfdefault}       % use non serif font
\usepackage{helvet}                             % use non serif font
\definecolor{orng}{HTML}{ff6700}                % define colors
\definecolor{grey}{HTML}{F0F0F0}                % define colors
\newcommand{\agencyName}{Agency}                % specific agency name
\newcommand{\mailAddr}{[email protected]} % mailto addresses list

% Global Styles for the \TextField
\def\DefaultOptionsofText{
        print,
        %bordercolor={0 0 0},
        backgroundcolor=grey,
        width=4.6cm,
        borderwidth=0
        %height=5pt
}

\hypersetup{
  pdfauthor   = {XXX},
  pdfkeywords = {XXXXX},
  pdftitle    = {YYYYYYYYY}
}

\begin{document}
\begin{Form}[action=mailto:\mailAddr{},encoding=html,method=post]

\begin{table}[!ht]
\resizebox{\textwidth}{!}{
\begin{tabular}{p{13.5cm}rr}
\textcolor{orng}{TITLE MAGIC \agencyName{} XXXX}&
\Submit[color=grey,bordersep={0 1 0}]{Send}&
\Reset[backgroundcolor=grey]{Reset}
\\
\end{tabular}}
\end{table}

\begin{table}[!ht]
\begin{small}
\begin{tabular}{llll}
Kunde:&\TextField[name=customer]{}&Einsatzdauer Basis in Stunden:&\TextField[name=onSetTime]{}
\vspace{1mm}\\
Kundennummer:&\TextField[name=customerNr]{}&Einstzfauer Zusatz in Sunden:&\TextField[name=onSetExtras]{}
\vspace{1mm}\\
Anzahl Zimmer:&\TextField[name=roomFromAmount,width=1cm]{} von \TextField[name=roomToAmount,width=1cm]{}&Einsatztag:&\TextField[name=onSetDay]{}
\vspace{1mm}\\
Etage:&\TextField[name=floor]{}&Einsatzzeit:&\TextField[name=seviceTime]{}
\vspace{1mm}\\
Anzahl Stockwerke:&\TextField[name=floorFromAmount,width=1cm]{} von \TextField[name=floorToAmount,width=1cm]{}&Putzfrau:&\TextField[name=employee]{}
\vspace{1mm}\\
Haustiere:&\TextField[name=petAnimals]{}&Rhytmus:&\TextField[name=interval]{}
\vspace{1mm}\\
&&&\\
\multicolumn{4}{l}{asldkjflkasj faslkj flkasdj flksadj fjkasdlj flaskdfj!}\\
\end{tabular}
\end{small}
\end{table}

\begin{table}[!ht]
\begin{small}
\begin{tabular}{|l|l|l|l|l|l|l|}
\cline{3-7}
\multicolumn{1}{l}{Anz. sep. WC}        &\TextField[width=3cm,name=toilAmount]{}        &\multirow{3}{*}{\rotatebox{90}{\hfill wöchentlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill täglich }} & \multirow{3}{*}{\rotatebox{90}{\hfill monatlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill bei Bedarf }} & \multirow{3}{*}{\rotatebox{90}{\hfill Zusatzarbeiten }} \\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{1}{l}{Anz. Nasszellen}     &\TextField[width=3cm,name=wetCellAmount]{}     &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\

\hline
\multicolumn{2}{|l|}{Nasszellen (Bad / Dusche / Toiletten)}&\mbox{\CheckBox[borderwidth=0.1mm,name=tblWetCell,width=3mm,height=3mm]{}}&\CheckBox[width=1mm,height=1mm]{ }& &            &                \\

\hline
\multicolumn{2}{|l|}{Abfalleimer in Küchenabfall leeren} & &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Wasserhähne polieren}             &             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Duschkabine} &             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Fliesen entkalken}&             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Lavabo inkl. Zahngläser + Seifenschalen}&             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Lüftung / Abzug}  &             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Radiator für Frottetücher abstauben}&             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{ } &           &         &           &            &                \\
\hline
\end{tabular}
\end{small}
\end{table}



\hfill ~\\

\end{Form}
\end{document}

答案1

也许以下内容更接近您想要实现的目标。我使用了固定宽度的居中列,并删除了表格边框和相应单元格内容之间的水平空白:

在此处输入图片描述

\documentclass[a4paper,10pt]{article}
\usepackage{amssymb} % needed for math
\usepackage{amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for german umlauts
\usepackage[ngerman]{babel} % this is needed for german umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[margin=1cm]{geometry} %layout
\usepackage{graphicx}   % to enable \resizebox for table sacling to \linewidth


\usepackage{array} % needed for \newcolumntype
% specifics

%\def\DefaultHeightofSubmit{12pt}
%\def\DefaultWidthofSubmit{2cm}
%\def\DefaultHeightofReset{12pt}
%\def\DefaultWidthofReset{2cm}
%\def\DefaultHeightofCheckBox{0.5\baselineskip}
%\def\DefaultWidthofCheckBox{0.5\baselineskip}
\usepackage{multirow}                           % for cells with multiple rows
\usepackage{graphicx}                           % needed for the tables
\usepackage{xcolor}                             % to make text in required color
\renewcommand{\familydefault}{\sfdefault}       % use non serif font
\usepackage{helvet}                             % use non serif font
\definecolor{orng}{HTML}{ff6700}                % define colors
\definecolor{grey}{HTML}{F0F0F0}                % define colors
\newcommand{\agencyName}{Agency}                % specific agency name
\newcommand{\mailAddr}{[email protected]} % mailto addresses list

% Global Styles for the \TextField
\def\DefaultOptionsofText{
        print,
        %bordercolor={0 0 0},
        backgroundcolor=grey,
        width=4.6cm,
        borderwidth=0
        %height=5pt
}


\usepackage{hyperref}  % this is needed for forms and links within the text
\hypersetup{
  pdfauthor   = {XXX},
  pdfkeywords = {XXXXX},
  pdftitle    = {YYYYYYYYY}
}


\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}


\begin{document}
\begin{Form}[action=mailto:\mailAddr{},encoding=html,method=post]

%\begin{table}[!ht]
%\resizebox{\textwidth}{!}{
\noindent
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}r@{\extracolsep{\tabcolsep}}r}
\textcolor{orng}{TITLE MAGIC \agencyName{} XXXX}&
\Submit[color=grey,bordersep={0 1 0}]{Send}&
\Reset[backgroundcolor=grey]{Reset}
\end{tabular*}%}
%\end{table}

%\begin{table}[!ht]
%\begin{small}
\small
\begin{tabular}{llll}
Kunde:&\TextField[name=customer]{}&Einsatzdauer Basis in Stunden:&\TextField[name=onSetTime]{}
\vspace{1mm}\\
Kundennummer:&\TextField[name=customerNr]{}&Einstzfauer Zusatz in Sunden:&\TextField[name=onSetExtras]{}
\vspace{1mm}\\
Anzahl Zimmer:&\TextField[name=roomFromAmount,width=1cm]{} von \TextField[name=roomToAmount,width=1cm]{}&Einsatztag:&\TextField[name=onSetDay]{}
\vspace{1mm}\\
Etage:&\TextField[name=floor]{}&Einsatzzeit:&\TextField[name=seviceTime]{}
\vspace{1mm}\\
Anzahl Stockwerke:&\TextField[name=floorFromAmount,width=1cm]{} von \TextField[name=floorToAmount,width=1cm]{}&Putzfrau:&\TextField[name=employee]{}
\vspace{1mm}\\
Haustiere:&\TextField[name=petAnimals]{}&Rhytmus:&\TextField[name=interval]{}
\vspace{1mm}\\
&&&\\
\multicolumn{4}{l}{asldkjflkasj faslkj flkasdj flksadj fjkasdlj flaskdfj!}\\
\end{tabular}
%\end{small}
%\end{table}

%\begin{table}[!ht]
%\begin{small}
\begin{tabular}{|l|l|@{}C{4ex}@{}|@{}C{4ex}@{}|l|l|l|}
\cline{3-7}
\multicolumn{1}{l}{Anz. sep. WC}        &\TextField[width=3cm,name=toilAmount]{}        &\multirow{3}{*}{\rotatebox{90}{\hfill wöchentlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill täglich }} & \multirow{3}{*}{\rotatebox{90}{\hfill monatlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill bei Bedarf }} & \multirow{3}{*}{\rotatebox{90}{\hfill Zusatzarbeiten }} \\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{1}{l}{Anz. Nasszellen}     &\TextField[width=3cm,name=wetCellAmount]{}     &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\
\multicolumn{2}{l|}{}                   &&&&&\\

\hline
\multicolumn{2}{|l|}{Nasszellen (Bad / Dusche / Toiletten)}&\CheckBox[borderwidth=0.1mm,name=tblWetCell1,width=4ex,height=1.5ex]{}&\CheckBox[borderwidth=0.1mm,name=tblWetCell2,width=4ex,height=1.5ex]{}& &            &                \\

\hline
\multicolumn{2}{|l|}{Abfalleimer in Küchenabfall leeren} &\CheckBox[borderwidth=0.1mm,name=tblWetCell3,width=4ex,height=1.5ex]{}&\CheckBox[borderwidth=0.1mm,name=tblWetCell4,width=4ex,height=1.5ex]{}          &           &            &                \\
\hline
\multicolumn{2}{|l|}{Wasserhähne polieren}             &             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Duschkabine} &             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Fliesen entkalken}&             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Lavabo inkl. Zahngläser + Seifenschalen}&             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Lüftung / Abzug}  &             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{Radiator für Frottetücher abstauben}&             &         &           &            &                \\
\hline
\multicolumn{2}{|l|}{ } &           &         &           &            &                \\
\hline
\end{tabular}
%\end{small}
%\end{table}

%
%
%\hfill ~\\

\end{Form}
\end{document}

答案2

您基本上必须确保复选框具有单元格的大小:

\documentclass[a4paper,10pt]{article}
\usepackage[ngerman]{babel} 
\usepackage[T1]{fontenc}    
\usepackage[margin=1cm]{geometry} %layout
\usepackage{array}
\usepackage{hyperref}  

\hypersetup{
    pdfauthor   = {XXX},
    pdfkeywords = {XXXXX},
    pdftitle    = {YYYYYYYYY}
}

\begin{document}
    \begin{Form}[action=mailto:xxx.com,encoding=html,method=post]


        \begin{table}[!ht]
           \begin{tabular}{l|@{}p{5mm}@{}|@{}p{5mm}@{}|}
            Kunde:&
            \CheckBox[name=cb1,charsize=12pt,width=5mm,height=\normalbaselineskip]{}&
            \CheckBox[name=cb2,charsize=12pt,width=5mm,height=\normalbaselineskip]{ }\\\hline
            Raum:&
            \CheckBox[name=cb3,charsize=12pt,width=5mm,height=\normalbaselineskip]{}&
            \CheckBox[name=cb4,charsize=12pt,width=5mm,height=\normalbaselineskip]{ }\\\hline        
           \end{tabular}

        \end{table}


    \end{Form}
\end{document}

在此处输入图片描述

答案3

我不知道这是否有帮助,但如果我这样做:

\documentclass[a4paper,10pt]{article}
\usepackage{amssymb} % needed for math
\usepackage{amsmath} % needed for math
\usepackage[utf8]{inputenc} % this is needed for german umlauts
\usepackage[ngerman]{babel} % this is needed for german umlauts
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[margin=1cm]{geometry} %layout
\usepackage{graphicx}   % to enable \resizebox for table sacling to \linewidth

% specifics
\usepackage{hyperref}  % this is needed for forms and links within the text
%\def\DefaultHeightofSubmit{12pt}
%\def\DefaultWidthofSubmit{2cm}
%\def\DefaultHeightofReset{12pt}
%\def\DefaultWidthofReset{2cm}
%\def\DefaultHeightofCheckBox{0.5\baselineskip}
%\def\DefaultWidthofCheckBox{0.5\baselineskip}
\usepackage{multirow}                           % for cells with multiple rows
\usepackage{graphicx}                           % needed for the tables
\usepackage{xcolor}                             % to make text in pfa color
\renewcommand{\familydefault}{\sfdefault}       % use non serif font
\usepackage{helvet}                             % use non serif font
\definecolor{orng}{HTML}{ff6700}                % define colors
\definecolor{grey}{HTML}{F0F0F0}                % define colors
\newcommand{\agencyName}{Agency}                % specific agency name
\newcommand{\mailAddr}{[email protected]} % mailto addresses list

% Global Styles for the \TextField
\def\DefaultOptionsofText{
    print,
    %bordercolor={0 0 0},
    backgroundcolor=grey,
    width=4.6cm,
    borderwidth=0
    %height=5pt
}

\hypersetup{
    pdfauthor   = {XXX},
    pdfkeywords = {XXXXX},
    pdftitle    = {YYYYYYYYY}
}

\begin{document}
    \begin{Form}[action=mailto:\mailAddr{},encoding=html,method=post]

        \begin{table}[!ht]
            \resizebox{\textwidth}{!}{
                \begin{tabular}{p{13.5cm}rr}
                    \textcolor{orng}{TITLE MAGIC \agencyName{} XXXX}&
                    \Submit[color=grey,bordersep={0 1 0}]{Send}&
                    \Reset[backgroundcolor=grey]{Reset}
                    \\
            \end{tabular}}
        \end{table}

        \begin{table}[!ht]
            \begin{small}
                \begin{tabular}{llll}
                    Kunde:&\TextField[name=customer]{}&Einsatzdauer Basis in Stunden:&\TextField[name=onSetTime]{}
                    \vspace{1mm}\\
                    Kundennummer:&\TextField[name=customerNr]{}&Einstzfauer Zusatz in Sunden:&\TextField[name=onSetExtras]{}
                    \vspace{1mm}\\
                    Anzahl Zimmer:&\TextField[name=roomFromAmount,width=1cm]{} von \TextField[name=roomToAmount,width=1cm]{}&Einsatztag:&\TextField[name=onSetDay]{}
                    \vspace{1mm}\\
                    Etage:&\TextField[name=floor]{}&Einsatzzeit:&\TextField[name=seviceTime]{}
                    \vspace{1mm}\\
                    Anzahl Stockwerke:&\TextField[name=floorFromAmount,width=1cm]{} von \TextField[name=floorToAmount,width=1cm]{}&Putzfrau:&\TextField[name=employee]{}
                    \vspace{1mm}\\
                    Haustiere:&\TextField[name=petAnimals]{}&Rhytmus:&\TextField[name=interval]{}
                    \vspace{1mm}\\
                    &&&\\
                    \multicolumn{4}{l}{asldkjflkasj faslkj flkasdj flksadj fjkasdlj flaskdfj!}\\
                \end{tabular}
            \end{small}
        \end{table}

        \begin{table}[!ht]
            \begin{small}
                \begin{tabular}{|l|l|l|l|l|l|l|}
                    \cline{3-7}
                    \multicolumn{1}{l}{Anz. sep. WC}        &\TextField[width=3cm,name=toilAmount]{}        &\multirow{3}{*}{\rotatebox{90}{\hfill wöchentlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill täglich }} & \multirow{3}{*}{\rotatebox{90}{\hfill monatlich }} & \multirow{3}{*}{\rotatebox{90}{\hfill bei Bedarf }} & \multirow{3}{*}{\rotatebox{90}{\hfill Zusatzarbeiten }} \\
                    \multicolumn{2}{l|}{}                   &&&&&\\
                    \multicolumn{2}{l|}{}                   &&&&&\\
                    \multicolumn{1}{l}{Anz. Nasszellen}     &\TextField[width=3cm,name=wetCellAmount]{}     &&&&&\\
                    \multicolumn{2}{l|}{}                   &&&&&\\
                    \multicolumn{2}{l|}{}                   &&&&&\\

                    \hline
                    \multicolumn{2}{|l|}{Nasszellen (Bad / Dusche / Toiletten)}&\CheckBox[name=cb1,charsize=12pt,width=5mm,height=5mm]{ }&\CheckBox[name=cb2,charsize=12pt,width=5mm,height=5mm]{ }& &            &                \\

                    \hline
                    \multicolumn{2}{|l|}{Abfalleimer in Küchenabfall leeren} & &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{Wasserhähne polieren}             &             &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{Duschkabine} &             &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{Fliesen entkalken}&             &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{Lavabo inkl. Zahngläser + Seifenschalen}&             &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{Lüftung / Abzug}  &             &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{Radiator für Frottetücher abstauben}&             &         &           &            &                \\
                    \hline
                    \multicolumn{2}{|l|}{ } &           &         &           &            &                \\
                    \hline
                \end{tabular}
            \end{small}
        \end{table}


        \hfill ~\\

    \end{Form}
\end{document}

至少在 Acrobat 中,它对我来说看起来不错。不需要 mbox... 在其他查看器中看起来不同。 结果

相关内容