Removing tab separated column content

Hello

I am trying to remove the content of a particular column in a table. But it does not work if I used the game as below. The highlighted texts are not deleted (under product). Do not know why. Please help unravel.

Screen Shot 2016-08-29 at 5.33.12 PM.png

Tried coding:

var para=app.selection[0];
var myColumn=prompt("Enter column number to delete","");
if(myColumn){
var lines=para.contents.split('\r');
var no_of_lines = lines.length;
for(i = 1; i <= no_of_lines; i++)
{
var x = lines[i-1].split('\t');
app.findGrepPreferences = null;     
app.changeGrepPreferences = null; 
app.findGrepPreferences.findWhat=x[myColumn-1];
app.changeGrepPreferences.changeTo  ="";
para.changeGrep();
app.findGrepPreferences = null;     
app.changeGrepPreferences = null; 
}
}

Thank you

K

If you use the grep search, you escpape ' (' > '-(', but given your findWhat is clear, you can also use the text search!))

Try this one:

var curSel = app.selection[0];
var myColumn = prompt("Enter column number to delete","");

if (!myColumn) exit();

var allParas = curSel.paragraphs.everyItem().getElements();
app.findTextPreferences = app.changeTextPreferences = null;   

for (var i = allParas.length-1; i >= 0; i--) {
    var curPara = allParas[i];
    var curParaContents = curPara.contents;
    var x = curParaContents.split("\t");
    app.findTextPreferences.findWhat = x[myColumn-1];
    app.changeTextPreferences.changeTo  ="";
    curPara.changeText();
}

app.findTextPreferences = app.changeTextPreferences = null;

Tags: InDesign

Similar Questions

  • Bad alignment of the column header separator and separator columns in mx:DataGrid.

    Hi all

    I use a mx:DataGrid control in my project of extension for InDesign CS5/CS55.5/CS6. I personalized the style attributes of the DataGrid control to change its appearance as shown in the following image.

    SampleDataGrid.png

    Question: As we see in the picture that after changing this style attribute separator column header is not aligned with separator of columns of the DataGrid body (more clearly shown in the zoomed image).

    MisalignedSeparator.png

    I also found that if I remove the "headerColors" property then it seems (maybe because of camouflage of the dividing line white with the default color of the header, as shown in the image below).

    DefaultHeader.png

    Any suggestion/solution to correct this lack of alignment.

    Notice that I must use this dark color appearance. I used FlashBuilder4.6, ExtensionBuilder2.1, ExtensionBuilder 3.4 SDK on Mac OS X 10.7.5.

    Here is the source code,

    DataGridExtension.mxml

    <? XML version = "1.0" encoding = "utf-8"? >

    "" < mx:Application xmlns:mx = "http://www.adobe.com/2006/mxml" layout ="absolute" historyManagementEnabled = "false"applicationComplete = "colorSync ()" creationComplete = "creationCompleteHandler (event)"> "

    < mx:Script >

    <! [CDATA]

    Import mx.collections.ArrayCollection;

    Import mx.events.FlexEvent;

    [Bindable]

    private var itemsObject:ArrayCollection = new ArrayCollection();

    public function colorSync():void{}

    AutoTheme.sync ();

    }

    protected function creationCompleteHandler(event:FlexEvent):void

    {

    itemsObject.addItem ({'page':'Page 01' 'status':"ready",'observation':'high quality'});

    itemsObject.addItem ({'page':' Page 02' 'status':'Waiting','observation':'low quality''});

    itemsObject.addItem ({'page':'Page 03' 'status':"ready",'observation':'high quality'});

    itemsObject.addItem ({'page':'Page 04' 'status':"ready",'observation':'high quality'});

    itemsObject.addItem ({'page':'Page 05' 'status':'Waiting','observation':'low quality'});

    itemsObject.addItem ({'page':'Page 06' 'status':"ready",'observation':'high quality'});

    itemsObject.addItem ({'page':'Page 07' 'status':"ready",'observation':'high quality'});

    }

    []] >

    < / mx:Script >

    < mx:Style >

          MX | DataGrid { }

    headerColors: #333333, #333333

    alternatingItemColors: #222222 #252525

    textRollOverColor: #FFFFFF

    textSelectedColor: #FFFFFF

    color: #CDCDCD;

    borderStyle: solid;

    rollOverColor: #333333

    selectionColor: #444444

    -color of the border: #222222

    textSelectedColor: #ffffff

    dropShadowEnabled: fake

            cornerRadius: 4

    }

    < / mx:Style >

    "" < mx:VBox height = "100%" width ="100%" verticalAlign = "middle" horizontalAlign ="center">

    " < mx:Spacer height ="10"width ="100%"/ >

    "" " < mx:DataGrid id ="pageDataGrid"dataProvider =" itemsObject{}"verticalAlign ="middle"width ="100%"buttonMode ="true"height ="100%">

    < mx:columns >

    "" < mx:DataGridColumn dataField = "page" headerText ="Page" width = "50"/ > "

    "" < mx:DataGridColumn dataField = "status" headerText ="status" width = "50"/ > "

    "" < mx:DataGridColumn dataField = "Note" headerText ="Note" width = "100"/ > "

    < / mx:columns >

    < / mx:DataGrid >

    < / mx:VBox >

    < / mx:Application >

    OK, the header separator is 2 pixels wide and that's why he is not in line with the separation of body that is only 1 pixel wide.

    Thank you. I solved the problem by adding a 'programming skin' based on 'mx.skins.halo.DataGridHeaderSeparator' that I defined for 'headerSeparatorSkin' mx:DataGrid property.

    I also tried adding a 'graph skin' by using a PNG image with a width of line 1 file x 22 pixels. This fixed the misalignment, but another problem because of which the last separator becomes 2 pixel wide while all others were 1 pixel wide.

    Here I post my code snippets for others,

    1. Add a new MyDataGridHeaderSeparator.mxml file for programmatic skin as follows (for example in the View.skin package).

    MyDataGridHeaderSeparator.mxml

    http://www.Adobe.com/2006/mxml '.

    xmlns:haloSkins = "" MX.skins.Halo. * ">"

    /**

    * Replaced it draw the line splitter in the DataGrid header columns. Since the default

    * implementation was originally 2 numbers when headerColors style in the DataGrid property changes

    * to match with the theme of dark color of the overall expansion,

    * 1. Misalignment of the separator in the header with the separation of body.

    * 2. Draw lines of separation of 2 pixels with the first in color light gray and others in dark grey.

    **/

    override protected function updateDisplayList(unscaledWidth:Number,_unscaledHeight:Number):void {}

    The line width value 1 pixel to draw lines 1 pixel wide divider.

    graphics.lineStyle (1, 0 x 000000);

    Go from x = 0 to x = 1 to solve the problem of misalignment.

    graphics.moveTo (1, 0);

    Draw the line of separation of (1,0) (1, unscaledHeight).

    graphics.lineTo (1, unscaledHeight);

    }

    ]]>

    And then simply set the property 'headerSeparatorSkin' of mx:DataGrid to this skin, for example inline definition property as below,

    hand. MXML

  • When I opened a new tab "chrome://lightning/content/newtab.html" appears automatically. I tried in safe mode without success.

    When I opened a new tab "chrome://lightning/content/newtab.html" appears automatically. I tried in safe mode without success.

    Hello unparadomas, try this to reset the page to the new tab manually: enter Subject: config in the bar firefox address (confirm the message information where it appears) & get preference named browser.newtab.url - right click and restore the default value for that entry.

    You can also run a full scan of your system with security tools like the free version of malwarebytes and adwcleaner to make sure that this change was not caused by adware or that it is present in other parts of the system as well.

    Fix Firefox problems caused by malicious software

  • To remove a separator in bookmarks

    I can't find a way to remove a separator that I created in the bookmarks. I tried right mouse click below of the separator, since I couldn't place the cursor on the separator and liquidation just delete the bookmark below the separator. I also do not see anything in the menu that allowed me to create the separator that allows me to remove the separator.
    [email protected]

    You must open the bookmarks Menu folder to view these separators in the right pane.

  • Tab separator

    Hello! I am a brand new world of LabView! I'm sorry if my question will lead to stupid!

    I want to use the function return the string data/time and I want to connect with function to concatenate strings... but I want data time with TAB separated because it is easier to enter data in Excel or Matlab. How can I do? What should I write based on "Channel 2" of the string to concatenate?

    The 'Constant tab', on the palette of the chain.

  • How to remove tabs, several spaces, quotes from data in the column.

    Hello

    How can we remove legs, several spaces, quotes from data in the column.

    Entry:

    H ope you 'are' Ingo w ell

    Output:

    H ope do you everything - there is a tab in hope and double-spaced in the well. This should be replaced by space. (Tab and multi spaces)

    I found myself with below:

    REGEXP_REPLACE (REGEXP_REPLACE (Replace (col, Chr (9),' '), ' () {2,} ', ' '),'[' ""]', ")

    Can we do more efficiently, your contributions are appreciated.

    I tried

    REGEXP_REPLACE (col,'[^ [a - z, A - Z, 0-9, Chr (0) - Chr (127) [: Space:]]] *', ") but the tabs still exist and that my data have German characters I can't go along with this.

    Thank you

    GVK.

    Hello

    Karthik417 wrote:

    Hello

    Thanks for your suggestion. In the above expression, we still missed to replace the double quotes.

    So thought we must use another regular expression instead of REPLACE.

    Select REGEXP_REPLACE (REGEXP_REPLACE (' H ope you "are" d "Ingo ell w ',' [' |])) CHR (9) | + ',' '),'["" "]') twice;

    I suppose we must use at least 2 REGEXP to achieve and cannot get it with a single expression.

    Thank you

    Sorry, I removed single quotes, not double - quote.  (This shows one of the reasons why having a few lines of sample data is very useful).

    I think you don't need 2 separate functions.  I do not think that the two must be REGEXP_REPLACE; You can use TRANSLATE to remove both types of quotation marks in a single function call:

    TRANSLATE (REGEXP_REPLACE (col

    , '[ ' || CHR (9) | ']+'

    , ' '

    )

    , '?'''"',

    , '?'

    )

    Of course, you can use use REGEXP_REPLACE to remove the quotes, if you really want to.

    Powerful they are, regular expressions are basically only 1 thing, things not 2 or more different.  Sometimes, he can watch as they do several things, because they can operate on character classes, like the series containing the and the and a variable number of characters.  For example, the REGEXP_REPLACE function, I used above is simply changing expression expression x y, where x is 1 consecutive or more characters of a given set.  As we both demonstrated, we can have a separate function that changes from p to q, but I know not all built-in function which, in general, can change x to y at the time that it changes from p to q.  TRANSLATE comes close, but TRANSLATE only works if x, y, p and q are single (or NULL), characters not expressions.

  • Remove the separator of columns and rows in spark DataGrid

    Capture.PNG

    Hello

    try searching a bit on the web with no success - how can I remove / handful of visibility of the separators of columns and rows in the DataGrid to spark flex 4.5

    See photo with separators:

    Two ways:

    (1) write a simple custom following appearance (the empty rectangles will cause the separators to disappear):

    
    
    
        
    
            
                
            
    
            
                
            
    
        
    
    
    

    (2) make a copy of the default Datagridskin and remove parts of skin 'columnSeparator' and 'rowSeparator.

    -Kevin

  • Remove only specific columns

    my tab as emp a structure below.
    employee_id number primary key, emp_name varchar2 (20) not null, mgr_id number, dept_id
    job_id varchar2 (10), salary number 4
    This table contains some data in it.

    When I run under query the oracle gives me an error...
    my query is = remove employee_id, salary, job_id from emp where dept_id = 90

    that its gives me an error = ORA-00933: SQL not correctly completed command
    u please can there which gives such a mistake?
    Thank you

    Hello

    Please see this use and DELETE syntax in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/B28359_01/server.111/b28286/statements_8005.htm#sthref7842
    REMOVE removes whole lines in a table.

    You probably want to update this table, leaving all the lines, but affecting some of the NULL columns on some lines, something like this:

    UPDATE     emp
    SET      employee_id     = NULL
    ,      salary          = NULL
    ,      job_id           = NULL
    WHERE     dept_id     = 90
    ;
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
    In the case of an operation DML (for example, DELETE or UPDATE), the sample data should show what looks like the tables before the DML, and results will be the content of the or the tables changed after the DML.
    Explain how you get these results from these data.
    Always tell what version of Oracle you are using.

  • I want to remove tabs, I don't want a bar of tabs above the address bar

    Old tabs keep appearing above the address bar with the same old in them content even if I tried everything to remove them.

    How can I remove these old tabs content, I am not interested?

    I have a MacBook Pro and I followed all the instructions provided by Mozilla and Google searches.

    You talk tabs on the tab bar?

    When these tabs appear?

    You cannot close the with a middle click or via the context menu on the tab bar?

    If they open when you click the Home button and then see:

    If they open when you launch Firefox as part of the restoration of session, so you can check for problems with the sessionstore.js and sessionstore.bak files in the profile folder of Firefox that store session data.

    Delete the sessionstore.js file possible sessionstore-# .js files with a number and sessionstore.bak in the Firefox profile folder.

    Delete sessionstore.js will cause App Tabs and tab groups and opened and closed the tabs (back) to get lost, so you will need to create them again (take note or bookmarks).

  • How can I remove lines "separator" bookmark?

    I want to eliminate all the separator lines in my favorites. I'd like them to go away.

    Hi, the separators that you created yourself can be removed by a right click on it > delete. Hope that helps.

  • How can I remove tab on upper left corner of the page describing the page?

    Navigation bar, top left, here's a tab telling me that I am on the page. This is redundant and boring, because I do not have the disorder. How can I remove it?

    See:

    You can watch this extension:

  • How can I remove a separator

    I accidentally added a separator that now, I want to delete. How to do this please?

    Hello, go bookmarks > show all boomarks (or press Ctrl + Shift + b) to open the library. then navigate to the folder where you experience this problem, select the separator that you want to delete and press the DELETE key or right-click them and remove them this way...

  • How to remove tabs Babylon

    I entered a program and so it also loaded the program "Babylon". It has already removed from the Control Panel, but continues to appear in my Firefox tabs all help to completely remove and get rid of this program from my system? I he would much appreciate your support.

    Thanks a lot for your kind help / J. Silva

    install the addon reset search

    Reset Firefox

    not better?

  • How can I DELETE / REMOVE tab Max more add-on? I hate it.

    I wanted to create a brand new page every time automatically for bookmarks and links to pages within Firefox. But someone on your blog told me that Firefox won't [despite all other browsers making].
    And instead advised me to try an add-on called Max Tab Plus.

    Well, I tried it. And I HATE it. So, how can I DELETE / REMOVE?

    See this:

    https://support.Mozilla.org/en-us/KB/disable-or-remove-add-ons

  • Unable to close/remove tabs in Safari

    Since Update 9.3.1 on iPad 2 air, there is no 'X' on any tab Safari makes it impossible to delete tabs. I stopped and restarted several times, but the tabs automatically re - appear. I have reviewed the settings, deleted the data from the cache and Web site. That's all I can think to do. Any suggestions?

    On my iPad Air, with the same software update, the 'x' is clearly visible and works as expected. I have noticed subtle differences in the functioning of these two units, but this is a first for me, to have a real malfunction with the updated software.

    Appreciate your thoughts.

    The x must be in the tab to the right. It is not tap two places in the upper right corner, then click the x on the thumbnail, or drag the thumbnail to the left to remove.

Maybe you are looking for

  • Satellite Pro A100 - flashing light battery and no start

    Hello I was sitting watching a video with my daughter yesterday when five minutes in my Satellite Pro A100 suddenly stopped working - cut out completely and not be reactivated. When I tried to restart the orange lit battery eleven short blinks blinke

  • ThinkPad E455 - update graphics card?

    I have a Lenovo ThinkPad E455 and my total area is 512 MB. Is it possible to replace a graphics card on a Lenovo ThinkPad? Note: I have AMD Radeon graphics card on my computer. Mod edit: edition display and moved to its own thread in the right forum.

  • Intelimouse explore & elite Bluetooth keyboard

    Just updated the operating system from XP to Windows 7 and can't get my wireless keyboard or mouse works after update the software and drivers from the website Solutions for Windows. Device Manager displays the Bluetooth receiver and says it's workin

  • BlackBerry Smartphones BlackBerry Curve 9300 problem

    Hello, I own a BlackBerry Curve 9300 with OS 6. Everything worked very well with the device, no problem at all, but suddenly a few days ago my camera got off while the battery was still 80% charged, when I plugged in the charger, something strange ha

  • WiFi won't connect unless the laptop is charging

    If my laptop is still very new, about 2 months, but over the 3 days it stopped to connect to any wireless signal, unless he is in charge. It's very embarrassing that you could imagine, and I was wondering if there is any way to fix it.