-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAutoTable3.0.jsx
86 lines (57 loc) · 2.19 KB
/
AutoTable3.0.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
var myTables;
var myFrame;
var globalWidth = 79;
getTables();
try {
// myTables.everyItem().appliedTableStyle = app.documents[0].tableStyles.item("正常表", true);
myTables.everyItem().cells.everyItem().appliedCellStyle = app.documents[0].cellStyles.item("单元格样式1", true);
myTables.everyItem().cells.everyItem().clearCellStyleOverrides(true);
myTables.everyItem().cells.everyItem().texts.everyItem().appliedParagraphStyle = app.documents[0].paragraphStyles.item("表文", true);
myTables.everyItem().cells.everyItem().texts.everyItem().clearOverrides();
//myTable.cells.everyItem().appliedCellStyle=app.documents[0].cellStyles.item("正常单元格",true);
//myTable.rows.everyItem().cells.everyItem().texts.everyItem().appliedParagraphStyle=app.documents[0].paragraphStyles.item("表格正文",true);
//myTable.cells.texts.everyItem().appliedParagraphStyle=app.documents[0].paragraphStyles.item("表格正文",true);
} catch (err) {
}
for (var i = 0; i < myTables.length; i++) {
var scare = globalWidth / myTables[i].width;
for (var m=0;m<myTables[i].columns.length;m++){
myTables[i].columns[m].width *= scare;
}
}
function getTables() {
if (app.documents.length != 0) {
if (app.selection.length > 0) {
myObjectList = new Array;
myTables = app.selection[0].tables;
myFrame = app.selection[0].parent;
}
}
// return app.selection;
}
// pwmRow(myTable.everyItem().columns);
// function pwmRow(theRow) {
// for (theColumn in theRow) {
// var overflower = theRow.everyItem().cells.anyItem().overflows;
// while (!overflower) {
// doPart(theColumn);
// overflower = theRow.everyItem().cells.anyItem().overflows;
// }
// while (overflower) {
// doDobble(theColumn);
// overflower = theRow.everyItem().cells.anyItem().overflows;
// }
// function doPart(row) {
// row.width = row.width * 0.5
// }
// function doDobble(row) {
// row.width = row.width + (row.width * 0.5)
// }
// }
// }
// function getHeight(f) {
// return f.geometricBounds[2] - f.geometricBounds[0];
// }
// function getweith(f) {
// return f.geometricBounds[3] - f.geometricBounds[1];
// }