自动填充 space 每行的固定列宽
Autofill space up to fixed Column width on each line
我试图在大型数据集上将每行的列宽设置为固定的“511”宽度。如果该行的列宽小于 511,那么我想在该行的末尾添加 space 直到它具有 511 列宽。目前,我 运行 喜欢很多列宽不规则的条目。例如,如果列宽为 450,即小于 511,那么我将手动添加 space 直到它具有 511 宽度,如果列宽超过 511,那么我将删除 space 直到它为 511。当前数据集有超过 100 万行,所以我想知道是否有更快的方法在每行末尾添加“spaces”。非常感谢任何帮助。
Sample of irregular column width
如果不规则的行不多(如果大多数行都是511个字符长),你可以使用这个宏。否则,此宏可能需要很长时间才能完成。
COLUMN = 511 + 1; // add 1 to the width
Redraw = false;
nLines = document.GetLines();
for( y = 1; y <= nLines; ++y ) {
document.selection.SetActivePoint( eePosLogical, 1, y );
document.selection.EndOfLine( false, eeLineLogical );
x = document.selection.GetActivePointX( eePosLogical );
if( x < COLUMN ) {
s = "";
for( i = COLUMN - x ; i > 0; --i ) {
s += " ";
}
document.selection.Text = s;
}
else if( x > COLUMN ) {
document.selection.SetActivePoint( eePosLogical, COLUMN, y, true );
document.selection.Delete();
}
}
到运行这个,保存这个代码,例如AutoSpace.jsee
,然后select这个文件从Select... 在 宏 菜单中。最后,select 运行 AutoSpace.jsee 在 Macros 菜单中。
我试图在大型数据集上将每行的列宽设置为固定的“511”宽度。如果该行的列宽小于 511,那么我想在该行的末尾添加 space 直到它具有 511 列宽。目前,我 运行 喜欢很多列宽不规则的条目。例如,如果列宽为 450,即小于 511,那么我将手动添加 space 直到它具有 511 宽度,如果列宽超过 511,那么我将删除 space 直到它为 511。当前数据集有超过 100 万行,所以我想知道是否有更快的方法在每行末尾添加“spaces”。非常感谢任何帮助。
Sample of irregular column width
如果不规则的行不多(如果大多数行都是511个字符长),你可以使用这个宏。否则,此宏可能需要很长时间才能完成。
COLUMN = 511 + 1; // add 1 to the width
Redraw = false;
nLines = document.GetLines();
for( y = 1; y <= nLines; ++y ) {
document.selection.SetActivePoint( eePosLogical, 1, y );
document.selection.EndOfLine( false, eeLineLogical );
x = document.selection.GetActivePointX( eePosLogical );
if( x < COLUMN ) {
s = "";
for( i = COLUMN - x ; i > 0; --i ) {
s += " ";
}
document.selection.Text = s;
}
else if( x > COLUMN ) {
document.selection.SetActivePoint( eePosLogical, COLUMN, y, true );
document.selection.Delete();
}
}
到运行这个,保存这个代码,例如AutoSpace.jsee
,然后select这个文件从Select... 在 宏 菜单中。最后,select 运行 AutoSpace.jsee 在 Macros 菜单中。