Script to resize all tables in a document
I'm using Framemaker 11, and have tons of tables that need to be resized so that they fit within the text frame. Does anyone know of a script or a fast way to resize all the tables in a document at once?
TableCleaner does a bunch more than just resizing, and is one of the best values I've seen for a plugin.
Looks like he's switching his content to a Wordpress site, so here's Rick's direct info:
rick at frameexpert dot com
[use link: http://www.frameexpert.com/old/]
Similar Messages
-
A script to delete all table rows containing a specific text
Hello,
I've tried some old scripts but can't get around to the right solution.
I need a script that will delete all rows in a table that contain a specific single-word text, something like "xxx".
Anyone's got an idea?
ThanksHi,
To remove a row use row.remove() method.
So iterate through table.rows and remove the one matched a condition.
If we talk about condition you have to be more accurate - what do you mean "a row contain a text":
==> 1st cell contains,
==> any cell contains.
Entire row contents is an array of its cells.contents, so your 1st row text is:
rows[0].contents.join(" ") ==> string
Jarek -
Hello,
This is my first post, but I have been working with InDesign scripting for a while, and am pretty fluent in Javascript.
My scenario is, I have a document with about 1,000 pages. On each page is a table with approximately 100 cells, 10 rows and 10 columns with a description at the 0-space of each, followed by a floating point number (in the form of a percentage) in every other cell. What I need to do is format the text color of each percentage in each row depending on its value. For instance, in the first row, every percentage under 80.00% is red, while everything else needs to be green. All I need to do is color them based on their value. However, this value changes throughout the course of the 10 different rows.
I was able to make a script that would allow me to go over each cell in row 1 of every table on a single page, then iterate over all the other remaining pages in the same way before continuning onto row 2. This is a VERY long process, typically leading to a crash in any document over ~30 pages in length. Given that I want to run this over a gigantic 1,000+ page document (granted there is only 1 table per page), it becomes slightly impractical...
I'm simply curious if there is a way to run this in a more realistic manner. There has to be a quick way to iterate over each row, simply check the values, mark green or red and be done with it. My idea was to, perhaps, do every row in the table on one page and then go onto the next page, as opposed to row 1 over the entire document, followed by row 2, and so on and so forth? Perhaps that would help?
The code is FARRR too long to post here, but the rough process I have right now is the following:
1.) Setup variables to define the cells in each row:
var allTables = app.activeDocument.stories.everyItem().tables.everyItem();
var firstRowCells = allTables.rows[1].cells.everyItem().getElements();
(There has to be a way to optimize that???)
2.) Call a bunch of for statements for the amount of rows I need to process (10) per table:
for(var i = 0; i < firstRowCells.length; ++i)
var a = parseFloat(firstRowCells[i].contents);
if(a <= 80.00)
firstRowCells[i].texts[0].appliedCharacterStyle = "FAIL Red";
} else if(a > 80.00){
firstRowCells[i].texts[0].appliedCharacterStyle = "PASS Green";
...all of this (about 10 for statements) results in a pretty rough crash. Anybody have a solution? Or at least an optimization tip?
Thanks,
-ChrisThe goal is to make it as automated as possible, as these 1,000 page documents will be occurring about twice a week (as far as I know).
Here is what I'm looking at now with six rows programmed for a demo of my situation (figured I'd include a dummy first row for example):
The grep style hasn't changed, except varies from line to line to meet the goal criteria, but here is the code for the six rows. Again, all I need it to do is make the same code work in the same way on all tables in the document and we're golden. This seems like the right approach, though, as it is much faster than the parseFloat() call method. (Sorry about the hard to read code...for some reason it doesn't paste well into these forums??)
var cStyles = app.activeDocument.characterStyles;
if((cStyles.item("FAIL Red") != null) && (cStyles.item("PASS Green") != null))
for(var i = 2; i < 6; ++i)
firstRowCells[i].appliedCellStyle = "80";
firstRowCells[6].appliedCellStyle = "Trend";
firstRowCells[7].appliedCellStyle = "80";
pBar.hit();
for(var i = 2; i < 6; ++i)
secondRowCells[i].appliedCellStyle = "80";
secondRowCells[6].appliedCellStyle = "Trend";
secondRowCells[7].appliedCellStyle = "80";
pBar.hit();
for(var i = 2; i < 6; ++i)
thirdRowCells[i].appliedCellStyle = "80";
thirdRowCells[6].appliedCellStyle = "Trend";
thirdRowCells[7].appliedCellStyle = "80";
pBar.hit();
for(var i = 2; i < 6; ++i)
fourthRowCells[i].appliedCellStyle = "40";
fourthRowCells[6].appliedCellStyle = "Trend";
fourthRowCells[7].appliedCellStyle = "40";
pBar.hit();
for(var i = 2; i < 6; ++i)
fifthRowCells[i].appliedCellStyle = "50";
fifthRowCells[6].appliedCellStyle = "Trend";
fifthRowCells[7].appliedCellStyle = "50";
pBar.hit();
for(var i = 2; i < 6; ++i)
sixthRowCells[i].appliedCellStyle = "30";
sixthRowCells[6].appliedCellStyle = "Trend";
sixthRowCells[7].appliedCellStyle = "30";
pBar.hit();
} else {
alert("Please setup character styles for PASS Green and FAIL Red, and re-run the program.");
Thanks again, Trevor, for all the help!!
-Chris
Edit: Actually...it didn't paste too too poorly after all once I clicked "Post"...hmmmm... -
List all columns having only nulls from all tables in a database.
I want to select columns from all tables having only null values. Each table has 60+ columns and i have 100+ tables in database. Requesting a script to list all tables at a time and their columns having all nulls? Below is my expected output. Thank
you in advance !
Table name
Null valued Column
Address
Address Line 2
Address
Address Line 3
Address
Zip Code
Product
Product Desc
Product
Product SKUHello,
In addition to Naomi's reply, you can refer to the following links about loop through all the tables in the database:
http://www.codeproject.com/Tips/161663/Loop-through-all-tables-in-SQL-Server
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/07b9799e-aeab-442e-99a0-ba76ab051f59/looping-through-databases-and-count-the-number-of-items-in-a-specific-table?forum=transactsql
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Script to update all TOCs in all open (or book) documents?
Does anyone know of a script that will update all table of contents in all open documents (or even better: all documents in open ID book)?
Any help much appreciated!FileMaker Pro is just a database and as such is not designed to work well with Automator which relies on knowing exactly what kind of information is being passed to it. Address Book can import "tab-delimited and comma-separated text." The best way would be to export from FileMaker in one of those formats and then import into Address Book. Beyond that it gets much more complicated.
-
How can I get my Indesign script to apply to all pages in the document?
My script (java) shown below will only apply to the first page of the document. How can i get it to apply to all pages of my document? What am I missing? Thanks.
scirpt:
myDocument = app.activeDocument
with (myDocument.pages.item(0).marginPreferences){
columnCount = 1;
//columnGutter can be a number or a measurement string.
columnGutter = "0";
bottom = "0"
//When document.documentPreferences.facingPages == true,
//"left" means inside; "right" means outside.
left = "0"
right = "0"
top = "0"
inside = "0"Hi,
You have to iterate through all pages.marginPreferences:
var
myDocument = app.activeDocument,
allPagesMaPref = myDocument.pages.everyItem().marginPreferences,
curPageMaPref;
while ( curPageMaPref = allPagesMaPref.pop() )
with (curPageMaPref) {
columnCount = 1;
//columnGutter can be a number or a measurement string.
columnGutter = "0";
bottom = "0"
//When document.documentPreferences.facingPages == true,
//"left" means inside; "right" means outside.
left = "40"
right = "0"
top = "0"
inside = "0"
Jarek -
[CS3 JS]Get all the tables in the document
Hello All,
I want to return all of the tables in the document, including those in table cells. I am using this:
var aTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
but it doesn't get tables inside of tables. Is there an easy way to do this without checking each table cell? Thanks in advance.
Rick Quatro
585-659-8267Hi Robin and Dave,
Thanks for your replies. This seems to work fine regardless of the nexting level.
Rick
var oDocTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
if (oDocTables.length)
oDocTables = GetAllTables(oDocTables);
alert(oDocTables.length);
function GetAllTables(oTables)
for(var i=0; i < oTables.length; i++)
var oCells = oTables[i].cells;
for (var j=0; j < oCells.length; j++)
var oCellTables = oCells[j].tables.everyItem().getElements();
if (oCellTables.length)
oTables = oTables.concat(oCellTables);
return oTables; -
Copying tables from the pdf file & loosing all table format when pasted into a word document
I have tables in an Adobe Reader 9.2 file that need to be placed in a word document.
When I copy the table and paste it into the word document I loose all table formating and am left w/just text--and, not in the right places, I might add.
Help please!!
Thanks! EdieThe only thing that comes close is to use the Snapshot tool (from the Tools Menu) and copy the entire table and paste it, but it treats it as a graphic (picture) and you can no longer edit cells.
-
Process XML attributes of all tables in a structured document
Hi all,
I try to process the XML attributes of all tables in a structured document.
When I use SelectedTbl everything works fine for the selected table and the attributes of the tabelle Element are written correctly to the Console.
doc = app.ActiveDoc;
table = doc.SelectedTbl;
if (table.TblElement)
Console('Elementname: ' + table.TblElement.ElementDef.Name);
tblEle = table.Element;
attrs = tblEle.GetAttributes();
for (i = 0; i < attrs.len; i++) {
aName = attrs[i].name;
aWert = attrs[i].values;
Console( " " + aName + " " + aWert);
However when I use GetText(Constants.FTI_TblAnchor) to walk through all tables of the documens neither ElementDef.Name nor Attributes are processed.
var flow = doc.FirstFlowInDoc;
var textItems = flow.GetText(Constants.FTI_TblAnchor);
while(iTab<textItems.length) {
table = textItems[iTab].obj;
if (table.TblElement)
Console('Elementname: ' + table.TblElement.ElementDef.Name);
tblEle = table.Element;
attrs = tblEle.GetAttributes();
for (i = 0; i < attrs.len; i++) {
aName = attrs[i].name;
aWert = attrs[i].values;
Console( " " + aName + " " + aWert);
Any Suggestions?
Yours
WolfgangYou'll probably want all the tables from the main flow. Try
var flow = doc.MainFlowInDoc;
Kind regards
JoH -
Script to generate all the tables and objects in a schema
how to write a script to generate all the tables and objects in a schema.
with toad the no of tables generated is not matching when i check from schema .Dear Sidhant,
Try this script:
set termout off
set feedback off
set serveroutput on size 100000
spool ddl_schema.sql
begin
dbms_output.put_line('--');
dbms_output.put_line('-- DROP TABLES --');
dbms_output.put_line('--');
for rt in (select tname from tab order by tname) loop
dbms_output.put_line('DROP TABLE '||rt.tname||' CASCADE CONSTRAINTS;');
end loop;
end;
declare
v_tname varchar2(30);
v_cname char(32);
v_type char(20);
v_null varchar2(10);
v_maxcol number;
v_virg varchar2(1);
begin
dbms_output.put_line('--');
dbms_output.put_line('-- CREATE TABLES --');
dbms_output.put_line('--');
for rt in (select table_name from user_tables order by 1) loop
v_tname:=rt.table_name;
v_virg:=',';
dbms_output.put_line('CREATE TABLE '||v_tname||' (');
for rc in (select table_name,column_name,data_type,data_length,
data_precision,data_scale,nullable,column_id
from user_tab_columns tc
where tc.table_name=rt.table_name
order by table_name,column_id) loop
v_cname:=rc.column_name;
if rc.data_type='VARCHAR2' then
v_type:='VARCHAR2('||rc.data_length||')';
elsif rc.data_type='NUMBER' and rc.data_precision is null and
rc.data_scale=0 then
v_type:='INTEGER';
elsif rc.data_type='NUMBER' and rc.data_precision is null and
rc.data_scale is null then
v_type:='NUMBER';
elsif rc.data_type='NUMBER' and rc.data_scale='0' then
v_type:='NUMBER('||rc.data_precision||')';
elsif rc.data_type='NUMBER' and rc.data_scale<>'0' then
v_type:='NUMBER('||rc.data_precision||','||rc.data_scale||')';
elsif rc.data_type='CHAR' then
v_type:='CHAR('||rc.data_length||')';
else v_type:=rc.data_type;
end if;
if rc.nullable='Y' then
v_null:='NULL';
else
v_null:='NOT NULL';
end if;
select max(column_id)
into v_maxcol
from user_tab_columns c
where c.table_name=rt.table_name;
if rc.column_id=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (v_cname||v_type||v_null||v_virg);
end loop;
dbms_output.put_line(');');
end loop;
end;
declare
v_virg varchar2(1);
v_maxcol number;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- PRIMARY KEYS --');
dbms_output.put_line('--');
for rcn in (select table_name,constraint_name
from user_constraints
where constraint_type='P'
order by table_name) loop
dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
dbms_output.put_line ('PRIMARY KEY (');
v_virg:=',';
for rcl in (select column_name,position
from user_cons_columns cl
where cl.constraint_name=rcn.constraint_name
order by position) loop
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.constraint_name;
if rcl.position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcl.column_name||v_virg);
end loop;
dbms_output.put_line(')');
dbms_output.put_line('USING INDEX );');
end loop;
end;
declare
v_virg varchar2(1);
v_maxcol number;
v_tname varchar2(30);
begin
dbms_output.put_line('--');
dbms_output.put_line('-- FOREIGN KEYS --');
dbms_output.put_line('--');
for rcn in (select table_name,constraint_name,r_constraint_name
from user_constraints
where constraint_type='R'
order by table_name) loop
dbms_output.put_line ('ALTER TABLE '||rcn.table_name||' ADD (');
dbms_output.put_line ('CONSTRAINT '||rcn.constraint_name);
dbms_output.put_line ('FOREIGN KEY (');
v_virg:=',';
for rcl in (select column_name,position
from user_cons_columns cl
where cl.constraint_name=rcn.constraint_name
order by position) loop
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.constraint_name;
if rcl.position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcl.column_name||v_virg);
end loop;
select table_name
into v_tname
from user_constraints c
where c.constraint_name=rcn.r_constraint_name;
dbms_output.put_line(') REFERENCES '||v_tname||' (');
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.r_constraint_name;
v_virg:=',';
select max(position)
into v_maxcol
from user_cons_columns c
where c.constraint_name=rcn.r_constraint_name;
for rcr in (select column_name,position
from user_cons_columns cl
where rcn.r_constraint_name=cl.constraint_name
order by position) loop
if rcr.position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcr.column_name||v_virg);
end loop;
dbms_output.put_line(') );');
end loop;
end;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- DROP SEQUENCES --');
dbms_output.put_line('--');
for rs in (select sequence_name
from user_sequences
where sequence_name like 'SQ%'
order by sequence_name) loop
dbms_output.put_line('DROP SEQUENCE '||rs.sequence_name||';');
end loop;
dbms_output.put_line('--');
dbms_output.put_line('-- CREATE SEQUENCES --');
dbms_output.put_line('--');
for rs in (select sequence_name
from user_sequences
where sequence_name like 'SQ%'
order by sequence_name) loop
dbms_output.put_line('CREATE SEQUENCE '||rs.sequence_name||' NOCYCLE;');
end loop;
end;
declare
v_virg varchar2(1);
v_maxcol number;
begin
dbms_output.put_line('--');
dbms_output.put_line('-- INDEXES --');
dbms_output.put_line('--');
for rid in (select index_name, table_name
from user_indexes
where index_name not in (select constraint_name from user_constraints)
and index_type<>'LOB'
order by index_name) loop
v_virg:=',';
dbms_output.put_line('CREATE INDEX '||rid.index_name||' ON '||rid.table_name||' (');
for rcl in (select column_name,column_position
from user_ind_columns cl
where cl.index_name=rid.index_name
order by column_position) loop
select max(column_position)
into v_maxcol
from user_ind_columns c
where c.index_name=rid.index_name;
if rcl.column_position=v_maxcol then
v_virg:='';
end if;
dbms_output.put_line (rcl.column_name||v_virg);
end loop;
dbms_output.put_line(');');
end loop;
end;
spool off
set feedback on
set termout on Best Regards,
Francisco Munoz Alvarez
www.oraclenz.com -
How can I Reconcile all tables on multiples mappings with scripting????
I have OWB 9.2.0.2.8
I have to reconcile all tables and external tables on multiple mappings.
How can I do it with scripting language, please?
Thanks very much in advance!!!!Good afternoon Claudio,
Should be something like this:
foreach mapName [OMBLIST MAPPINGS] {
puts "Checking $mapName"
foreach tabName [OMBRETRIEVE MAPPING '$mapName' GET TABLE OPERATORS] {
puts "Reconciling $tabName"
OMBRECONCILE TABLE '$tabName' \
TO MAPPING '$mapName' \
OPERATOR '$tabName' \
USE (RECONCILE_STRATEGY 'REPLACE', MATCHING_STRATEGY 'MATCH_BY_OBJECT_ID');
}If you want to alter reconcile and/or matching strategy, check documentation on OMBRECONCILE in the OWB Scripting Reference.
Good luck, Patrick -
Script for dropping all the tables
Hello:
Can somebody share with me a script that will delete all the tables in a schema?
Thanks.I think what Justin was getting at is this: we cannot drop tables that are referenced by foreign keys. So before we can drop all tables weed to drop all referencing constraints. Which makes this script even more dangerous - you may wish to abort if other schemas reference the "droppee".
Let's be careful out there!
Cheers, APC
declare
cursor fks is
select owner,table_name, constraint_name
from all_constraints
where r_owner='&&schema_to_delete'
and constraint_type = 'R';
cursor tables is
select owner,table_name
from all_tables
where owner='&&schema_to_delete';
begin
for b in fks
loop
dbms_output.put_line( 'drop fk constraint '||b.owner||'.'||b.table_name||'.'||b.constraint_name);
execute immediate 'alter table '||b.owner||'.'||b.table_name||' drop constraint '||b.constraint_name;
end loop;
for c in tables
loop
dbms_output.put_line( 'drop table '||c.owner||'.'||c.table_name);
execute immediate 'drop table '||c.owner||'.'||c.table_name;
end loop;
end;
/ -
How to get script of all tables through DBMS_METADATA.GET_DDL
Hi friends
Is there any way thr which i can generate script off all tables at one time...
select dbms_metadata.get_ddl('TABLE','CONSUMER','UPCLMAIN')FROM DUAL;
I ve 78 tables and its too tedious to to one by one and i am working in 10 g...
thanks
sonal....How about
select dbms_metadata.get_ddl('TABLE',table_name,owner)FROM dba_tables where owner='yourschema';
Regards,
PP -
Script to add not null columns to all tables in database
Hello,
I need to add 5 not null columns to my existing database (all tables).
The problem is that i do not want to loose the current data.
I need a script so that i need not do this manually for each table.
Can u suggest?
VishalHello,
I need to add 5 not null columns to my existing database (all tables).
The problem is that i do not want to loose the current data.
I need a script so that i need not do this manually for each table.
Can u suggest?
Vishal I always follow this step
1) Alter table <<tablename>> add(<<columnname>> <<datatype>>)
2) Update <<tablename>> set <<columnname>>=<<anyvalue>>
3) Alter table <<tablename>> modify(<<columnname>> <<datatype>> not null)
else
1) rename <<tablename>> to <<tablenamebk>>
2) drop table <<tablename>>
3) Alter table <<tablenamebk>> add(<<columnname>> <<datatype>>)
4) update <<tablenamebk>> set <<columnname>>=<<anyvalue>>
5) create table <<tablename>> (with additional columns with not null)
6) insert into <<tablename>> select * from <<tablenamebk>> -
Hi there,
Just wondering if someone can give me the PowerShell script to list ALL documents bigger than 10MB - in list attachments/libraries all over my site?
Really appreciated.
Thank you.Hello,
here you can find sample to help you create yoru script :
http://sharepointpromag.com/sharepoint/windows-powershell-scripts-sharepoint-info-files-pagesweb-parts
see this sample extract from this site
Get-SPWeb http://sharepoint/sites/training |
Select -ExpandProperty Lists |
Where { $_.GetType().Name -eq "SPDocumentLibrary" -and
-not $_.Hidden }
|
Select -ExpandProperty Items |
Where { $_.File.Length -gt 5000 } |
Select Name, {$_.File.Length},
@{Name="URL";
Expression={$_.ParentList.ParentWeb.Url
+ "/" + $_.Url}}
this can help too :
https://gallery.technet.microsoft.com/office/Get-detail-report-of-all-b29ea8e2
Best regards, Christopher.
Blog |
Mail
Please remember to click "Mark As Answer" if a post solves your problem or
"Vote As Helpful" if it was useful.
Why mark as answer?
Maybe you are looking for
-
Hi to all , I' ve problem while fetching bsad for a report , in t-code se30 i've seen that it takes %89,1 performance of overall. SELECT belnr buzei dmbtr blart budat augdt augbl sgtxt into table odemelerg FROM bsad WHERE bukr
-
Job prints but is then stuck in queue - LaserJet P1102 with JetDirect 175x print server
Hello, I have an unusual error happening when i try to install my P1102 through a print server. Everything installs ok and allows me to print a test page, the next document i try to print prints ok but the job remains in the queue and stays there. Af
-
Viewing Cannon Raw images in Bridge
I normally shoot with my Nikon D3, But I recently borrowed a Canon. When viewing my Nikon Raw images in Bridge, I am able to see the Images. But when I try to view the Canon Raw Images, all I see are Icons. Is there a setting that allows me to see th
-
Setting the max and min bounds of a result set
I'm trying to set the upper and lower bound values of a result set. Meaning, I want to limit the values in my result set to not be below/above a certain number, BUT I want any number in my result set that is below/above the lower/upper bound that i h
-
Delivery completed indicator wrt Mat document & P.O
Hello why is it that at times the "Delivery completed indicator of the material document not set " while the "Delivery completed indicator of the purchase order item" is set. can anyone explain the logic behind this ? Thanks