• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Table Formatting

Explorer ,
Oct 31, 2023 Oct 31, 2023

Copy link to clipboard

Copied

Hi everyone,
I'm creating a table using the "anchor frame" and "text frame" tools that have content that needs to be hidden, but the problem is that when hidden, the table will have unnecessary extra space.

Qun2929_0-1698737898540.png


Is there any solution to solve this case? Please suggest.

Best regards,
Quan

Views

226

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 31, 2023 Oct 31, 2023

Copy link to clipboard

Copied

Hi Quan,

Which anchor gets the condition? The anchor of the anchored frame? Or the table?

The anchored frame should get the condition.

If the space comes from an empty paragraph, then you have to apply the condition also to the paragraph mark of the previous paragraph.

Best regards, Winfried

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 31, 2023 Oct 31, 2023

Copy link to clipboard

Copied

Hi @Winfried Reng ,

This is an image from my original and I still don't understand what you mean.

Qun2929_1-1698745838435.png

Looking forward to your guidance!
Best regards,
Quan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 31, 2023 Oct 31, 2023

Copy link to clipboard

Copied

Hi, @Quân2929 ,

looking at your screenshot I think you want the surrounding text-frame to automatically get smaller as content gets hidden.

That does not happen as a text-frame has a specified size and will not change dynamically.

You can change the size of the text-frame manually or by using a script.

Regards

Stephan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 31, 2023 Oct 31, 2023

Copy link to clipboard

Copied

Hi @mk-will ,
Thank you for your answer, I also think it is not possible to shrink the frame automatically. If there is any other solution, please contact me.
Best regards,
Quan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 31, 2023 Oct 31, 2023

Copy link to clipboard

Copied

I would create 2 copies of the table in 2 separate frames - one with all you want to show & the second with the cells truncated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 01, 2023 Nov 01, 2023

Copy link to clipboard

Copied

hi @Jeff_Coatsworth ,

I will test and apply this solution

Best regards,
Quan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 01, 2023 Nov 01, 2023

Copy link to clipboard

Copied

Here is what is possible with scripting. To try it, copy the code to a text file and save it with a .jsx extension. Control-click on the text frame containing the table to select it and choose File > Script > Run and select the script. It will resize the height of the text frame to match the table's height. The script could be enhanced to run automatically, etc.

 

A note to other scripters: See how I have broken the script down into discreet functions, each having its own task. Please let me know if you have any questions or comments.

 

#target framemaker

main ();

function main () {

    var doc;
    
    doc = app.ActiveDoc;
    if (doc.ObjectValid () === 1) {
        processDoc (doc);
    }
}

function processDoc (doc) {

    var textFrame, tbl;
    
    // See if a text frame without a named flow is selected.
    textFrame = doc.FirstSelectedGraphicInDoc;
    if ((textFrame.ObjectValid () === 1) && (textFrame.Flow.Name === "")) {
        // Get the table object in the text frame.
        tbl = getTbl (textFrame, doc);
        if (tbl) {
            processTblFrame (tbl, textFrame, doc);
        }    
    }
}

function processTblFrame (tbl, textFrame, doc) {
    
    var PT, row, height;
    
    // Constant for point value.
    PT = 65536;
    
    // Calculate the location of the bottom of the last row,
    // relative to the top of the text frame.
    row = tbl.LastRowInTbl;
    height = (row.LocY + row.Height) - textFrame.LocY;
    
    // Resize the text frame's height.
    textFrame.Height = height;
}

function getTbl (textFrame, doc) {

    var textList, tbl;
    
    textList = textFrame.GetText (Constants.FTI_TblAnchor);
    if (textList.length === 1) {
        tbl = textList[0].obj;
        return tbl;
    }
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 01, 2023 Nov 01, 2023

Copy link to clipboard

Copied

Hi @frameexpert ,
Thanks for your solution,
When I apply this code to the current file, will it affect other files?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 01, 2023 Nov 01, 2023

Copy link to clipboard

Copied

LATEST

It will only work on the selected text frame (Control+Click to select it). As I said, it could be modified to work in all kinds of ways.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines