[go: up one dir, main page]

JP2007115024A - Automatic column width adjustment method for table - Google Patents

Automatic column width adjustment method for table Download PDF

Info

Publication number
JP2007115024A
JP2007115024A JP2005305834A JP2005305834A JP2007115024A JP 2007115024 A JP2007115024 A JP 2007115024A JP 2005305834 A JP2005305834 A JP 2005305834A JP 2005305834 A JP2005305834 A JP 2005305834A JP 2007115024 A JP2007115024 A JP 2007115024A
Authority
JP
Japan
Prior art keywords
column
width
maximum
column width
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2005305834A
Other languages
Japanese (ja)
Inventor
Mitsunori Ishizaka
光典 石坂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hitachi Software Engineering Co Ltd
Original Assignee
Hitachi Software Engineering Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hitachi Software Engineering Co Ltd filed Critical Hitachi Software Engineering Co Ltd
Priority to JP2005305834A priority Critical patent/JP2007115024A/en
Publication of JP2007115024A publication Critical patent/JP2007115024A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • User Interface Of Digital Computer (AREA)
  • Digital Computer Display Output (AREA)
  • Information Transfer Between Computers (AREA)
  • Document Processing Apparatus (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an optimized automatic column width adjustment method when displaying a table, capable of automatically adjusting a column width so as to substantially minimize the vertical width of the table, even if the column width of the table is not specified clearly. <P>SOLUTION: The sum of the data lengths of data for the respective columns of the table is obtained, the data length of the data of the entire table is obtained, and the ratio of the data lengths of the respective columns to the data length of the entire table is obtained and defined as the initial value of the ratio of the respective column widths with respect to the entire horizontal width. Among the cells of the respective columns within prescribed rows, the number of newlines of the cell of the maximum column width and the number of newlines of the column, where the number of newlines is maximum, are compared. When the number of newlines of the column, where the number of newlines is maximum, is larger than the number of newlines of the cell of the maximum column width, the processing of adjusting the column width, by reducing the column width of the column of the maximum column width by a prescribed amount and increasing the column width of the column, where the number of newlines is maximum by the reduced prescribed amount is repeated, until the number of newlines of the cell of the maximum column width becomes equal to or larger than the number of line feeds of the column where the number of line feeds is a maximum. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、Webブラウザでテーブル(表)を表示するときなどに、自動的にテーブルの縦幅を調整することにより、所定の横幅内にテーブルを収め、かつ、テーブルの構造自体を見やすい形に調整する列幅自動調整方法に関するものである。   The present invention automatically adjusts the vertical width of the table when the table is displayed on a Web browser, etc., so that the table is contained within a predetermined horizontal width and the table structure itself is easy to see. The present invention relates to a column width automatic adjustment method to be adjusted.

インターネットの普及に伴い、Webページの閲覧はごく当たり前のものとなってきている。中でも集計データなどを見やすく表示させるためにテーブル構造がよく使用されている。   With the spread of the Internet, browsing web pages has become quite commonplace. In particular, a table structure is often used to make it easy to see the aggregated data.

通常、Web上においてテーブル構造を表示させるためには、例えば図4に示すようにHTML(HyperText Markup Language)言語のtableタグを用いる。図4のHTMLを基にしてブラウザ(Webページを閲覧する際に利用されるソフトウェアの総称)上に表示されるテーブル構造の具体例が図2である。図4中の41〜44に示すtdタグで囲まれた文字列が、図2中の21〜24に示す1マスにそれぞれ対応し、さらにそれらをtrタグで囲み1行の区切りとし、テーブル構造が形成される。   Usually, to display the table structure on the Web, for example, a table tag of HTML (HyperText Markup Language) language is used as shown in FIG. FIG. 2 shows a specific example of the table structure displayed on the browser (generic name of software used when browsing a Web page) based on the HTML of FIG. The character string enclosed by td tags shown by 41 to 44 in FIG. 4 corresponds to one cell shown by 21 to 24 in FIG. 2, and is further enclosed by tr tags to make a line delimiter. Is formed.

このようにしてテーブル構造を表示させる際、表示領域がブラウザ等の画面幅に収まらない場合がある。この不便さを解消するため、幾つかの技術が提案されている。例えば、特許文献1には、閲覧画面からはみ出す画像や表に関して、画像の縮小や縦横方向の入れ換えなどによりファクシミリ端末の解像度内に納まるようにするファクシミリ端末出力用の画像変換技術が開示されている。特許文献2には、ホームページ上の入力フィールドが画面の幅を超えないように調整することにより、横スクロールを必要としないブラウザを提供する技術が開示されている。特許文献3には、画像の表示サイズが表示画面のサイズを超えたとき、その画像を代替の画像に置換して表示し、その画像が選択されたときサーバからダウンロードして表示する技術が開示されている。特許文献4には、ポータル画面を表示する際に、各ポートレット表示領域が画面内に入るように表示内容を調節して表示する技術が開示されている。
特開平11−15749号公報 特開2002−63016号公報 特開2002−91849号公報 特開2004−252688号公報
When the table structure is displayed in this way, the display area may not fit within the screen width of a browser or the like. In order to eliminate this inconvenience, several techniques have been proposed. For example, Patent Document 1 discloses an image conversion technique for output of a facsimile terminal so that an image or a table that protrudes from the browsing screen can be accommodated within the resolution of the facsimile terminal by reducing the image or changing the vertical and horizontal directions. . Patent Document 2 discloses a technique for providing a browser that does not require horizontal scrolling by adjusting an input field on a homepage so as not to exceed the width of the screen. Patent Document 3 discloses a technique for displaying an image by replacing it with a substitute image when the display size of the image exceeds the size of the display screen, and downloading and displaying the image when the image is selected. Has been. Patent Document 4 discloses a technique for adjusting and displaying the display contents so that each portlet display area falls within the screen when the portal screen is displayed.
Japanese Patent Laid-Open No. 11-15749 JP 2002-63016 A JP 2002-91849 A JP 2004-252688 A

ところで、上記の特許文献1〜4に記載の技術は、何れも、画面がスクロールしないように調整したり、決まった横幅内にテーブルが収まるように調整するというものであり、テーブルの構造自体を見やすい形に補正するという類のものではない。例えば、これらの従来技術を用いてテーブルに何も列幅を指定せずに表示させた場合、データ量に関わらず均等な幅に調整され、テーブル全体の縦幅が非常に長くなってしまい、視覚的にテーブル全体を捉えにくいという問題がある。列幅を手動で調整することによりこの問題は解決できるが、それを行うためにはどうしても手間がかかる。   By the way, each of the techniques described in Patent Documents 1 to 4 described above is such that the screen is adjusted so as not to scroll, or the table is adjusted so that the table fits within a predetermined horizontal width. It is not the kind of correction that makes it easy to see. For example, if these conventional techniques are used to display a table without specifying any column width, it is adjusted to an equal width regardless of the amount of data, and the vertical width of the entire table becomes very long. There is a problem that it is difficult to visually grasp the entire table. Although this problem can be solved by manually adjusting the column width, it takes time and effort to do so.

本発明の目的は、明示的にテーブルの列幅を指定していない状態であっても自動的に列幅をテーブルの縦幅がほぼ最小となるようにすることができるテーブル表示時における最適化された列幅自動調整方法を提供することにある。   An object of the present invention is to optimize a column width at the time of a table display which can automatically make the column width almost the minimum even if the column width of the table is not explicitly specified. It is to provide a column width automatic adjustment method.

上記目的を達成するために、本発明は、コンピュータを用いてテーブルを表示または印刷する際に該テーブルの各列幅を自動調整するテーブルの列幅自動調整方法であって、コンピュータが備えるデータ長解析手段が、テーブルの各列ごとのデータのデータ長の和を求めるステップと、コンピュータが備える列幅仮定手段が、前記各列のデータ長の和をさらに合計してテーブル全体のデータのデータ長を求めるとともに、該テーブル全体のデータ長に対する各列のデータ長の割合を求め、該各列のデータ長の割合を、テーブル全体の横幅に対する各列幅の割合の初期値として設定するステップと、コンピュータが備える最終列幅確定手段が、所定行内の各列のセルのうち、最大列幅のセルの改行数と改行数が最大の列の当該改行数とを比較し、前記最大列幅のセルの改行数より前記改行数が最大の列の当該改行数の方が大きい場合は、前記最大列幅の列の列幅を所定量減らし前記改行数が最大の列の列幅を前記減らした所定量増やすことにより列幅を調整する処理を、前記最大列幅のセルの改行数が前記改行数が最大の列の当該改行数以上になるまで繰り返すステップとを備えることを特徴とする。   In order to achieve the above object, the present invention provides a table column width automatic adjustment method for automatically adjusting each column width of a table when the table is displayed or printed using a computer, the computer comprising a data length The analysis means calculates the sum of the data lengths of the data for each column of the table, and the column width assumption means provided in the computer further sums the sum of the data lengths of the respective columns to add the data length of the data of the entire table Determining the ratio of the data length of each column to the data length of the entire table, and setting the ratio of the data length of each column as an initial value of the ratio of the column width to the horizontal width of the entire table; The final column width determination means provided in the computer compares the number of line breaks in the cell with the maximum column width with the number of line breaks in the column with the maximum number of line breaks, out of the cells in each column in the predetermined row. If the number of line breaks in the column with the largest number of line breaks is greater than the number of line breaks in the cell with the maximum column width, the column width of the column with the maximum column width is reduced by a predetermined amount, and the column of the column with the largest number of line breaks Repeating the process of adjusting the column width by increasing the width by the predetermined amount until the number of line breaks in the cell having the maximum column width is equal to or greater than the number of line breaks in the column having the maximum number of line breaks. Features.

本発明によれば、最大列幅のセルの改行数と改行数が最大の列の当該改行数とを比較し、最大列幅のセルの改行数より改行数が最大の列の当該改行数の方が大きい場合は、それらの列の間で列幅を調整するので、明示的にテーブルの列幅を指定していない状態であっても自動的に列幅をテーブル全体の縦幅をより小さく、ほぼ最小となるようにすることができる。   According to the present invention, the number of line breaks of the cell with the maximum column width is compared with the number of line breaks of the column with the maximum number of line breaks, and the number of line breaks of the column with the maximum number of line breaks is greater than the number of line breaks of the cell with the maximum column width. If the table width is larger, the column width is adjusted between those columns, so even if the table column width is not explicitly specified, the column width is automatically reduced to a smaller overall table width. Can be almost minimized.

以下、本発明を適用したテーブル表示時における最適化された列幅自動調整方法の一実施の形態について説明する。   Hereinafter, an embodiment of an optimized column width automatic adjustment method at the time of table display to which the present invention is applied will be described.

図1は、本発明の実施の形態に係る列幅自動調整方法の適用対象であるシステムのハードウェア構成図である。11はデータを入力するキーボード及びマウス等の入力部を表す。12はデータを処理する中央処理装置及び主記憶装置等をまとめたデータ処理部を表す。13はハードディスク等の外部記憶装置を表す。14はディスプレイ等の表示部を表す。データ処理部12では、Webブラウザが動作しており、不図示のネットワーク経由でイントラネットやインターネット上のWebページを閲覧できる。このような構成は、汎用のコンピュータにWebブラウザなどのソフトウェアをインストールすることで実現できる。特に、本発明に係るテーブル表示の列幅自動調整方法を実現するためのプログラムは、例えばプラグインソフトの形でWebブラウザに組み込まれて動作するものである。   FIG. 1 is a hardware configuration diagram of a system to which a column width automatic adjustment method according to an embodiment of the present invention is applied. Reference numeral 11 denotes an input unit such as a keyboard and a mouse for inputting data. Reference numeral 12 denotes a data processing unit that collects a central processing unit, a main storage device, and the like that process data. Reference numeral 13 denotes an external storage device such as a hard disk. Reference numeral 14 denotes a display unit such as a display. In the data processing unit 12, a Web browser is operating, and a Web page on an intranet or the Internet can be browsed via a network (not shown). Such a configuration can be realized by installing software such as a Web browser on a general-purpose computer. In particular, a program for realizing the column width automatic adjustment method for table display according to the present invention operates by being incorporated into a Web browser in the form of plug-in software, for example.

図2は、本実施形態による列幅自動調整を施す前のテーブルの表示例を示す。データ量が最も多い列22に対して列幅が適切に割り当てられていないため、表全体の縦幅が間延びしている。このサンプルの状態では全体を一目で見渡せるためまだ見難いことはないが、これが何ページにも渡っていると非常に見難いテーブルになってしまう。   FIG. 2 shows a display example of a table before performing automatic column width adjustment according to the present embodiment. Since the column width is not appropriately assigned to the column 22 having the largest data amount, the vertical width of the entire table is extended. In the state of this sample, you can see the whole at a glance, so it is not difficult to see yet, but if it is over many pages, it becomes a very difficult table to see.

図3は、本実施形態による列幅自動調整を施した後のテーブルの表示例である。一番データ量の多い列32に対して最大の列幅を割り当ててあり、他の列に関してもデータ量に応じて各列幅が最適化されているため、表全体の縦幅が縮小され、データ的に見やすい状態になっていることが分かる。   FIG. 3 is a display example of the table after the column width automatic adjustment according to the present embodiment. Since the maximum column width is assigned to the column 32 with the largest amount of data, and the width of each column is optimized according to the amount of data for other columns, the vertical width of the entire table is reduced, It can be seen that the data is easy to see.

図4は、図2のテーブルのHTML表現である。図2のテーブルにおけるデータ21が、図4における表現41に対応する。同様に、図2の22が図4の42、図2の23が図4の43、図2の24が図4の44に、それぞれ対応する。表現41から44までをtrタグで囲む。trタグの一まとまりが、テーブルの1行に対応する。以降の行も同様に定義される。   FIG. 4 is an HTML representation of the table of FIG. Data 21 in the table of FIG. 2 corresponds to the representation 41 in FIG. Similarly, 22 in FIG. 2 corresponds to 42 in FIG. 4, 23 in FIG. 2 corresponds to 43 in FIG. 4, and 24 in FIG. 2 corresponds to 44 in FIG. Enclose expressions 41 to 44 with tr tags. A group of tr tags corresponds to one row of the table. Subsequent lines are defined similarly.

図5は、図3のテーブルのHTML表現である。図3におけるデータ31が、図5における表現51に対応する。同様に、図3の32が図5の52、図3の33が図5の53、図3の34が図5の54に、それぞれ対応する。図4との違いは、表現51〜54のそれぞれのtdタグ内において列幅の指定を行っている点である。列51では20%、列52では50%、列53では15%、列54では15%と、それぞれ百分率で指定し、テーブル全体の横幅の何%を割り当てるか指定している。   FIG. 5 is an HTML representation of the table of FIG. Data 31 in FIG. 3 corresponds to the representation 51 in FIG. Similarly, 32 in FIG. 3 corresponds to 52 in FIG. 5, 33 in FIG. 3 corresponds to 53 in FIG. 5, and 34 in FIG. 3 corresponds to 54 in FIG. The difference from FIG. 4 is that the column width is specified in the respective td tags of the expressions 51 to 54. 20% in the column 51, 50% in the column 52, 15% in the column 53, and 15% in the column 54, each of which is specified as a percentage, and specifies what percentage of the total width of the table is allocated.

本実施形態の図1のシステムでブラウザ上に所定のWebページを表示する際、そのWebページ中にテーブル構造が含まれている場合には、データ処理部12により、以下の図6のデータ長解析ステップ、図7の列幅の仮定ステップ、及び図8の最終列幅確定ステップを順に実行し、列幅の自動調整を行う。これにより、例えば図2及び図4のようなテーブルが図3及び図5のように自動調整される。   When a predetermined web page is displayed on the browser in the system of FIG. 1 of the present embodiment, if the table structure is included in the web page, the data processing unit 12 causes the data length of FIG. The analysis step, the column width assumption step of FIG. 7, and the final column width determination step of FIG. 8 are executed in order to automatically adjust the column width. Thereby, for example, the tables as shown in FIGS. 2 and 4 are automatically adjusted as shown in FIGS.

図6は、データ長解析ステップを示すフローチャートである。最初に、テーブルデータをn×mの配列に格納する(ステップ62)。以降では、テーブルの行数の最大値をnとし、行数に対するループのカウンタとしてiを用いる。同様に、テーブルの列数の最大値をmとし、列数に対するループのカウンタとしてjを用いる。例えば、図2及び図4のテーブルであれば、n=5,m=4である。iは0,1,…,n-1をとり、j=0,1,…,m-1をとる。   FIG. 6 is a flowchart showing the data length analysis step. First, the table data is stored in an n × m array (step 62). Hereinafter, the maximum value of the number of rows in the table is n, and i is used as a loop counter for the number of rows. Similarly, the maximum value of the number of columns in the table is m, and j is used as a loop counter for the number of columns. For example, in the tables of FIGS. 2 and 4, n = 5 and m = 4. i takes 0,1, ..., n-1 and j = 0,1, ..., m-1.

次に、テーブルの行数分ループさせるために行数カウンタiに0をセットする(ステップ63)。iの値がnより小さい間は以降の処理を繰り返す(ステップ64)。最初はテーブルの1行目(iの値は0)に対して各列に対する処理を行う。   Next, in order to loop the number of rows in the table, 0 is set in the row number counter i (step 63). The following processing is repeated while the value of i is smaller than n (step 64). Initially, each column is processed for the first row of the table (i is 0).

次に、テーブルの列数分ループさせるために列数カウンタjに0をセットする(ステップ65)。jの値がmより小さい間は以降の処理を繰り返す(ステップ66)。配列a[j]は、列jにおけるデータ長の総和を格納するための領域である。各列に対してデータ長(行iかつ列jのセル(テーブルの1つのマス目に相当する)に表示するデータのデータ長)をバイト単位でこの配列に加えていくものとする(ステップ67)。また、配列a[j]には、図6の処理の開始時点で初期値として0が格納されているものとする。カウンタjの値を1増やし、j<mの条件を満たす限りステップ67及びステップ68の処理を繰り返す。   Next, 0 is set in the column number counter j to loop the number of columns in the table (step 65). The following processing is repeated while the value of j is smaller than m (step 66). The array a [j] is an area for storing the total data length in the column j. For each column, the data length (data length of data to be displayed in the cell of row i and column j (corresponding to the first cell in the table)) is added to this array in bytes (step 67). ). In addition, it is assumed that 0 is stored in the array a [j] as an initial value at the start of the process of FIG. The value of the counter j is incremented by 1, and the processing in step 67 and step 68 is repeated as long as the condition of j <m is satisfied.

j<mの条件が満たされなくなったときjのループを抜け、次の行の処理を行うためiの値を1増やし(ステップ69)、ステップ64の判定前まで戻る。   When the condition of j <m is not satisfied, the loop of j is exited, and the value of i is increased by 1 (step 69) in order to process the next line, and the process returns to the state before the determination of step 64.

以上の処理により、テーブル全体に対する各列のデータ長の総和を取得する。以上の処理が終了したとき、配列a[j]には各列jのデータ長の総和が設定されていることになる。図6の処理の後、図7の処理を行う。   Through the above processing, the sum of the data lengths of the columns for the entire table is acquired. When the above processing is completed, the sum of the data lengths of each column j is set in the array a [j]. After the process of FIG. 6, the process of FIG. 7 is performed.

図7は、列幅の仮定ステップを示すフローチャートである。ここでの目的は、図6のデータ長解析ステップで作成した配列aを用いてさらに各列のデータ長を合計し、各列に対しテーブル全体の横幅の何%を割り当てればよいか仮定する最初の指標を作成することにある。   FIG. 7 is a flowchart showing the column width assumption step. The purpose here is to further add up the data lengths of the columns using the array a created in the data length analysis step of FIG. 6 and assume what percentage of the total width of the table should be assigned to each column. The first indicator is to create.

まず、テーブルの列数分ループさせるために列数カウンタjに0を、テーブル内の全データ長を合計するための変数totalに0を、それぞれセットする(ステップ72)。jの値がmより小さい間は以降の処理を繰り返す(ステップ73)。列毎の合計値をさらに全列に対して合計することにより、テーブル全体のデータ長の合計値を求める(ステップ74)。カウンタjの値を1増やし(ステップ75)、j<mの条件を満たす限りステップ74及びステップ75の処理を繰り返す。   First, 0 is set in the column number counter j to loop the number of columns in the table, and 0 is set in the variable total for totaling all data lengths in the table (step 72). The following processing is repeated while the value of j is smaller than m (step 73). The total value for each column is further summed for all columns to obtain the total value of the data length of the entire table (step 74). The value of the counter j is incremented by 1 (step 75), and the processing of step 74 and step 75 is repeated as long as the condition of j <m is satisfied.

j<mの条件が満たされなくなったときjのループを抜け(ステップ73)、再度テーブルの列数分ループさせるために列数カウンタjに0をセットする(ステップ76)。jの値がmより小さい間は以降の処理を繰り返す(ステップ77)。列毎にテーブル全体の幅の何%を割り当てるかを配列bに格納する(ステップ78)。計算式は、「(各列のデータ長の総和a[j]/テーブルの全データ長total)×100(小数点第一位を四捨五入)」で求める。カウンタjの値を1増やし(ステップ79)、j<mの条件を満たす限りステップ78及びステップ79の処理を繰り返す。   When the condition of j <m is not satisfied, the loop of j is exited (step 73), and 0 is set to the column number counter j to loop again for the number of columns of the table (step 76). The following processing is repeated while the value of j is smaller than m (step 77). What percentage of the total width of the table is allocated for each column is stored in the array b (step 78). The calculation formula is obtained by “(total sum of data length of each column a [j] / total data length of table) × 100 (rounded to the first decimal place)”. The value of the counter j is incremented by 1 (step 79), and the processing of step 78 and step 79 is repeated as long as the condition of j <m is satisfied.

以上の処理により、テーブル全体に対する列毎の最初の割り当て値を取得する。すなわち、ここまでの処理で、配列b[j]には、テーブル全体の幅を100%としたときの各列jの列幅の割合(%値)が設定されたことになる。図7の処理の後、図8の処理を行う。   Through the above processing, the first assigned value for each column for the entire table is acquired. That is, in the processing up to this point, the ratio (% value) of the column width of each column j when the width of the entire table is 100% is set in the array b [j]. After the process of FIG. 7, the process of FIG. 8 is performed.

図8は、最終列幅確定ステップを示すフローチャートである。まず、システム側(具体的にはブラウザ等)からテーブル全体の横幅の値を取得しT_WIDに設定する(ステップ82)。この横幅値は、予め決められた所定の単位で表現されているものとする。例えば、ミリメートルやインチなどで表現した値、表示画面上のドット数、あるいは予め決められたフォントにより数えた文字数などである。   FIG. 8 is a flowchart showing the final column width determination step. First, the width value of the entire table is acquired from the system side (specifically, a browser or the like) and set to T_WID (step 82). It is assumed that the width value is expressed in a predetermined unit. For example, a value expressed in millimeters or inches, the number of dots on the display screen, or the number of characters counted with a predetermined font.

次に、テーブルの行数分ループさせるために行数カウンタiに0をセットする(ステップ83)。iの値がnより小さい間は以降の処理を繰り返す(ステップ84)。ここで、現在処理中の行iにおいて最適化が完了したことを判定するためのフラグflgにtrueをセットする(ステップ85)。flgがtrueの間は、最適化処理を続行し続ける(ステップ86)。   Next, in order to loop the number of rows in the table, 0 is set to the row number counter i (step 83). The following processing is repeated while the value of i is smaller than n (step 84). Here, true is set to the flag flg for determining that the optimization is completed in the currently processed line i (step 85). While flg is true, the optimization process continues (step 86).

次に、行iの各列における列幅の具体値を特定する(ステップ87)。配列b[j]に取得した値は割合であるため、ステップ82で取得したテーブル全体の横幅(T_WID)と配列b[j]の値を用いて具体的な各列の列幅の値を特定し、配列c[j]に格納するものとする。この処理はカウンタjを用いたループ処理でテーブルの各列に対して行うものとし、その際、列幅が最大となる列を示すカウンタ値jをmax_l_jに保持しておく。   Next, the specific value of the column width in each column of row i is specified (step 87). Since the value acquired in array b [j] is a ratio, the specific width value of each column is identified using the width (T_WID) of the entire table acquired in step 82 and the value of array b [j]. And stored in the array c [j]. This process is performed for each column of the table by a loop process using the counter j, and at this time, the counter value j indicating the column having the maximum column width is held in max_l_j.

次に、行iの各列における改行数を特定する(ステップ88)。この処理は、ステップ87で作成した各列の列幅の具体値を持つ配列c[j]と各列のデータ(行i列jのセルに表示するデータ)から、当該行i列jのセルで何行に渡って改行が起きているかを計算し、配列d[j]に格納するものである。この処理では、表示フォントの大きさや書式を考慮して実際に表示したときに何行に渡るかを求めるものとする。またこの処理はカウンタjを用いたループ処理で各列に対して行うものとし、その際、改行数が最大となる列を示すカウンタ値jをmax_c_jに保持しておく。   Next, the number of line breaks in each column of row i is specified (step 88). This processing starts from the array c [j] having the specific value of the column width of each column created in step 87 and the data of each column (data to be displayed in the cell of row i column j) in the cell of row i column j. The number of lines that have a new line is calculated and stored in the array d [j]. In this process, the number of lines to be obtained when actually displayed is determined in consideration of the size and format of the display font. Further, this process is performed for each column by a loop process using the counter j, and at this time, a counter value j indicating a column having the maximum number of line breaks is held in max_c_j.

次に、改行数が一番大きい列(max_c_jの列)の当該改行数が最大列幅の列(max_l_jの列)の改行数より大きいかどうかの判定を行う(ステップ89)。ここで、ステップ89の判定結果が偽になった場合は、flgにfalseをセットし(ステップ8c)、ステップ86の判定を経て、ステップ8dでiの値を1増加させ、テーブルの次の行の処理に移る。ステップ89の判定結果が真になった場合は、列幅が最適化されていない状態であると判断し、最大列幅の列の列幅b[max_l_j]の値から1マイナスし(ステップ8a)、最大改行数の列の列幅b[max_c_j]の値に1プラスする(ステップ8b)。その後、ステップ86の処理に戻り、再度列幅の最適化が行われているかどうかの判定処理を行い、flgがfalseになるまで処理を繰り返す。ステップ89,8a,8bは、要するに、改行数が一番大きいセルにおける当該改行数と最大列幅のセルの改行数とを比較し、前者の方が大きい場合に、後者の列幅を1%減らし前者の列幅を1%増やして列幅を調整する処理である。なお、ここでは1%ずつ増減させているが、増減させる量は任意である。   Next, it is determined whether or not the number of line breaks in the column with the largest number of line breaks (max_c_j column) is greater than the number of line breaks in the column with the maximum column width (max_l_j column) (step 89). Here, if the determination result in step 89 is false, flg is set to false (step 8c), and after the determination in step 86, the value of i is incremented by 1 in step 8d, and the next row of the table Move on to processing. If the determination result in step 89 becomes true, it is determined that the column width is not optimized, and one is subtracted from the value of the column width b [max_l_j] of the maximum column width (step 8a). Then, 1 is added to the value of the column width b [max_c_j] of the column of the maximum number of line breaks (step 8b). Thereafter, the process returns to step 86, and the process of determining whether or not the column width is optimized is performed again, and the process is repeated until flg becomes false. Steps 89, 8a, and 8b are, in summary, comparing the number of line breaks in the cell with the largest number of line breaks with the number of line breaks in the cell with the maximum column width, and if the former is larger, the latter column width is 1%. This is a process of adjusting the column width by increasing the former column width by 1%. Here, the amount is increased or decreased by 1%, but the amount to be increased or decreased is arbitrary.

以上の処理を全行に渡って施すことにより、テーブルの縦幅がほぼ最小となるように小さくでき、且つ各列幅のデータ量に応じて横幅が調整された最適化されたテーブルが完成する。最終的に、配列b[j]に各列jの百分率表現での列幅の割合が設定されているので、これを元に図5の51〜54に示すような各列の列幅指定を行えばよい。   By performing the above processing over all rows, an optimized table can be completed in which the vertical width of the table can be reduced to a minimum and the horizontal width is adjusted according to the data amount of each column width. . Finally, since the column width ratio in the percentage expression of each column j is set in the array b [j], the column width designation of each column as shown in 51 to 54 in FIG. Just do it.

図9は、本発明の一実施の形態例を施す前後、すなわち図2と図3をまとめた説明図である。これは本発明の適用イメージを分かりやすく示したものである。   FIG. 9 is an explanatory diagram summarizing FIGS. 2 and 3 before and after applying one embodiment of the present invention. This shows the application image of the present invention in an easy-to-understand manner.

なお、上記実施形態ではブラウザでテーブルを表示する場合の適用例を説明したが、これに限らず、本発明はテーブルを表示あるいは印刷する各種のケースで適用可能である。   In the above embodiment, the application example in which the table is displayed by the browser has been described. However, the present invention is not limited to this, and the present invention can be applied to various cases of displaying or printing the table.

本発明の一実施の形態例を施すハードウェア構成図である。It is a hardware block diagram which gives the example of 1 embodiment of this invention. 本発明の一実施の形態例を施す前のテーブル表示例を示す図である。It is a figure which shows the example of a table display before giving one embodiment of this invention. 本発明の一実施の形態例を施した後のテーブル表示例を示す図である。It is a figure which shows the example of a table display after giving one embodiment of this invention. 図2のHTML表現である。3 is an HTML representation of FIG. 図3のHTML表現である。4 is an HTML representation of FIG. データ長解析ステップを示すフローチャートである。It is a flowchart which shows a data length analysis step. 列幅の仮定ステップを示すフローチャートである。It is a flowchart which shows the assumption step of column width. 最終列幅確定ステップを示すフローチャートである。It is a flowchart which shows the last column width determination step. 本発明の一実施の形態例を施す前後をまとめた説明図である。It is explanatory drawing put together before and after giving one embodiment of this invention.

符号の説明Explanation of symbols

11…入力部、12…データ処理部、13…外部記憶装置、14…表示部。   11 ... Input unit, 12 ... Data processing unit, 13 ... External storage device, 14 ... Display unit.

Claims (1)

コンピュータを用いてテーブルを表示または印刷する際に該テーブルの各列幅を自動調整するテーブルの列幅自動調整方法であって、
コンピュータが備えるデータ長解析手段が、テーブルの各列ごとのデータのデータ長の和を求めるステップと、
コンピュータが備える列幅仮定手段が、前記各列のデータ長の和をさらに合計してテーブル全体のデータのデータ長を求めるとともに、該テーブル全体のデータ長に対する各列のデータ長の割合を求め、該各列のデータ長の割合を、テーブル全体の横幅に対する各列幅の割合の初期値として設定するステップと、
コンピュータが備える最終列幅確定手段が、所定行内の各列のセルのうち、最大列幅のセルの改行数と改行数が最大の列の当該改行数とを比較し、前記最大列幅のセルの改行数より前記改行数が最大の列の当該改行数の方が大きい場合は、前記最大列幅の列の列幅を所定量減らし前記改行数が最大の列の列幅を前記減らした所定量増やすことにより列幅を調整する処理を、前記最大列幅のセルの改行数が前記改行数が最大の列の当該改行数以上になるまで繰り返すステップと
を備えることを特徴とするテーブルの列幅自動調整方法。
A method for automatically adjusting a column width of a table for automatically adjusting each column width of the table when displaying or printing the table using a computer,
A data length analyzing means provided in the computer, obtaining a sum of data lengths of data for each column of the table;
Column width assumption means provided in the computer further calculates the data length of the data of the entire table by further summing the sum of the data lengths of the columns, and determines the ratio of the data length of each column to the data length of the entire table, Setting the ratio of the data length of each column as an initial value of the ratio of each column width to the horizontal width of the entire table;
The final column width determination means provided in the computer compares the number of line breaks of the cell with the maximum column width with the number of line breaks of the column with the maximum number of line breaks among the cells of each column in the predetermined row, and the cell with the maximum column width When the number of line breaks of the column with the maximum number of line breaks is larger than the number of line breaks of the column, the column width of the column with the maximum column width is reduced by a predetermined amount, and the column width of the column with the maximum number of line breaks is Repeating the process of adjusting the column width by quantitatively increasing the number of line breaks in the cell with the maximum column width until the number of line breaks is equal to or greater than the number of line breaks in the column with the largest number of line breaks. Automatic width adjustment method.
JP2005305834A 2005-10-20 2005-10-20 Automatic column width adjustment method for table Pending JP2007115024A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005305834A JP2007115024A (en) 2005-10-20 2005-10-20 Automatic column width adjustment method for table

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005305834A JP2007115024A (en) 2005-10-20 2005-10-20 Automatic column width adjustment method for table

Publications (1)

Publication Number Publication Date
JP2007115024A true JP2007115024A (en) 2007-05-10

Family

ID=38097135

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005305834A Pending JP2007115024A (en) 2005-10-20 2005-10-20 Automatic column width adjustment method for table

Country Status (1)

Country Link
JP (1) JP2007115024A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015170011A (en) * 2014-03-05 2015-09-28 日本電気株式会社 Table layout generator
CN113962193A (en) * 2021-11-15 2022-01-21 北京金山办公软件股份有限公司 Form layout method, device, electronic device and storage medium
CN114218902A (en) * 2021-11-15 2022-03-22 北京金山办公软件股份有限公司 Form processing method, apparatus, electronic device, and computer-readable storage medium
CN116029267A (en) * 2023-02-08 2023-04-28 信利光电股份有限公司 Excel data typesetting processing method, device and storage medium
CN120085862A (en) * 2025-05-07 2025-06-03 北京安证通信息科技股份有限公司 Front-end list width setting method, system, electronic device and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015170011A (en) * 2014-03-05 2015-09-28 日本電気株式会社 Table layout generator
CN113962193A (en) * 2021-11-15 2022-01-21 北京金山办公软件股份有限公司 Form layout method, device, electronic device and storage medium
CN114218902A (en) * 2021-11-15 2022-03-22 北京金山办公软件股份有限公司 Form processing method, apparatus, electronic device, and computer-readable storage medium
CN116029267A (en) * 2023-02-08 2023-04-28 信利光电股份有限公司 Excel data typesetting processing method, device and storage medium
CN120085862A (en) * 2025-05-07 2025-06-03 北京安证通信息科技股份有限公司 Front-end list width setting method, system, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US7900137B2 (en) Presenting HTML content on a screen terminal display
EP1854029B1 (en) Presentation of large objects on small displays
US7362311B2 (en) Single column layout for content pages
US8707159B1 (en) Translating tabular data formatted for one display device to a format for display on other display device
US6826725B1 (en) Techniques for invoking system commands from within a mark-up language document
US9916285B2 (en) Generating a preview of a web page for a mobile terminal
JP4248411B2 (en) Method, system, computer program and storage device for displaying a document
US8205152B2 (en) System and method for formatting and displaying frameset documents
CN104254849B (en) User terminal device and method supporting high-speed network scrolling of network documents
US8957912B2 (en) Displaying items in an application window
CN113392353A (en) Website page loading method and device, electronic equipment and storage medium
US20120236004A1 (en) Information output apparatus and information output method and recording medium
CN114969611B (en) Web page printing method, device, equipment and medium
US20190258699A1 (en) Scalable content rendering
CN109299449A (en) Form processing method and device, electronic equipment and readable storage medium
CN113934339A (en) Method and device for page self-adaptive layout based on rem
CN112434487A (en) Image-text typesetting method and device and electronic equipment
US20060041835A1 (en) User-controlled web browser table reduction
US6874122B1 (en) Computer system, program product and method of adjusting the display positions of hypertext links to modify the relative alignment thereof
JP2007115024A (en) Automatic column width adjustment method for table
JP2016095501A (en) Document layout for electronic display
US20040051723A1 (en) Method and device for displaying an image composed of pixels
JP5858479B2 (en) Terminal device and program
WO2005038673A1 (en) Presenting html content on a screen terminal display
CN114491344B (en) A method, device, equipment and medium for determining web page resource download type