T O P I C R E V I E W |
GaussianFit |
Posted - 12/03/2012 : 4:26:27 PM Origin Ver. and Service Release (Select Help-->About Origin): 8.1 SR3 Operating System: Windows 7
A quick question to ask: after importing the data into a worksheet, there are always some empty rows in it. I could manually delete these rows, but it didn't work for the case that the row number is less than 30. How to do this in Origin C? Should I use datarange class? A sample code would be helpful. Thanks for your help first! |
4 L A T E S T R E P L I E S (Newest First) |
GaussianFit |
Posted - 12/23/2012 : 11:22:12 PM Turned out that actually there is no need to delete empty rows, as long as I extract the length of a column first and use it to set the number for loop operation. Anyway thanks for all the tips!
quote: Originally posted by Penn
Hi,
Do you mean that you want to clear the data in the selected row? If so, you can delete this row first, and then insert an empty row in the same position. You can refer to these two methods, DeleteRow and InsertRow.
To get the selected rows in the worksheet, please try the GetSelectedRange method.
Penn
|
Penn |
Posted - 12/11/2012 : 10:04:30 PM Hi,
Do you mean that you want to clear the data in the selected row? If so, you can delete this row first, and then insert an empty row in the same position. You can refer to these two methods, DeleteRow and InsertRow.
To get the selected rows in the worksheet, please try the GetSelectedRange method.
Penn |
GaussianFit |
Posted - 12/11/2012 : 5:14:33 PM quote: Originally posted by Penn
Hi,
By default, worksheet will add rows automatically, which makes the situation you mentioned happens. You can select the menu Format: Worksheet to open the Worksheet Properties dialog, and then go to the Miscellaneous tab, and clear the Auto Add Rows check-box. Then you can try to delete the rows again. If you want to delete the empty rows by using Origin C, the first thing is also to clear this check-box. Please refer to the following code.
Tree tr;
tr.Root.Grid.AutoAddRows.nVal = 0; // format setting for clearing the check-box
if(0 == wks.UpdateThemeIDs(tr.Root))
{
wks.ApplyFormat(tr, true, true); // apply the settings, wks is worksheet variable
wks.SetSize(5, -1); // set size of worksheet, 5 rows
}
Penn
Thanks you so much for the tips. Indeed removing the check box worked for manual removal of empty rows. In my C code, the function "DeleteRows" was used to conditionally remove certain selected rows. For example, if the worksheet has 50 rows to start with, after running "DeleteRows" to remove 20 selected rows, it's left with 30 rows with data and 20 empty rows. I'm not sure if I could remove these 20 empty rows by inserting the C code you gave. |
Penn |
Posted - 12/03/2012 : 8:42:08 PM Hi,
By default, worksheet will add rows automatically, which makes the situation you mentioned happens. You can select the menu Format: Worksheet to open the Worksheet Properties dialog, and then go to the Miscellaneous tab, and clear the Auto Add Rows check-box. Then you can try to delete the rows again. If you want to delete the empty rows by using Origin C, the first thing is also to clear this check-box. Please refer to the following code.
Tree tr;
tr.Root.Grid.AutoAddRows.nVal = 0; // format setting for clearing the check-box
if(0 == wks.UpdateThemeIDs(tr.Root))
{
wks.ApplyFormat(tr, true, true); // apply the settings, wks is worksheet variable
wks.SetSize(5, -1); // set size of worksheet, 5 rows
}
Penn |
|
|