Retaining styles in table cells when deleting table
Author |
Message |
Denis #1 / 5
|
 Retaining styles in table cells when deleting table
Hello all Wasn't sure where to post this as I think it's somewhere between tables and userforms. Using Windows 98, Office 97 SR-2. I have a template which creates a document with a table of data based on the output from a userform. Users can edit the data in the table by clicking a toolbar button, upon which event a new userform is created, extracting the data from the table to allow editing. When the user has finished making changes, the table is deleted and a new one created to hold the new data. (The reason for deleting and recreating the table is that there are not guaranteed to be the same number of rows in the new table and the order of the data may be altered or the data may be deleted) I would like to know if there is a way of retaining any style/font changes that have been made to the data in individual cells, e.g. if the user manually selects the contents of the first cell and makes the text bold and underlined can this be retained with the text? I guess I'm asking if there is any way to record the style properties of a cell's contents so that, when the data is added to the new table, any original text retains it's style? Any help would, as always, be gratefully received. -- Denise Crawley
|
Fri, 09 Apr 2004 18:12:48 GMT |
|
 |
Suzanne S. Barnhil #2 / 5
|
 Retaining styles in table cells when deleting table
What you're talking about is not "style" but "direct formatting." Ordinarily I would say this was *more* likely to be retained than a style, but if you're round-tripping it through a UserForm, I think you'll find you lose it without extra VBA to retain it. For this reason, you're more likely to get the answer from one of the VBA gurus. -- Suzanne S. Barnhill Microsoft Word MVP Words into Type Fairhope, AL USA
Quote: > Hello all > Wasn't sure where to post this as I think it's somewhere between tables and > userforms. > Using Windows 98, Office 97 SR-2. > I have a template which creates a document with a table of data based on the > output from a userform. Users can edit the data in the table by clicking a > toolbar button, upon which event a new userform is created, extracting the > data from the table to allow editing. When the user has finished making > changes, the table is deleted and a new one created to hold the new data. > (The reason for deleting and recreating the table is that there are not > guaranteed to be the same number of rows in the new table and the order of > the data may be altered or the data may be deleted) > I would like to know if there is a way of retaining any style/font changes > that have been made to the data in individual cells, e.g. if the user > manually selects the contents of the first cell and makes the text bold and > underlined can this be retained with the text? I guess I'm asking if there > is any way to record the style properties of a cell's contents so that, when > the data is added to the new table, any original text retains it's style? > Any help would, as always, be gratefully received. > -- > Denise Crawley
|
Fri, 09 Apr 2004 21:26:58 GMT |
|
 |
Jay Freedma #3 / 5
|
 Retaining styles in table cells when deleting table
Hi, Denise, I'll preface this by saying that almost *anything* is possible if you're willing to put enough effort into it. To quote an old chestnut, though, just because something can be done doesn't mean it should be done. If the applied formatting really was a style, as set up in Format/Style (either a paragraph style or a character style, but you'd need to require that it be applied to the entire cell), then it would be fairly simple to record the name of the style and reapply it to the same cell(s). Then the complications start... If the rows are reordered, do you want the style to stay with the data, in which case you'd have to track its new position, or do you want it to be in the same cell but with the new data? Either way, it's possible and not terribly difficult. If the formatting is direct, the way you described it, then you're in deep doodoo. Direct character formatting can be done character by character -- for example, the third character could be made bold, the fourth one bold and underlined, and the fifth one in a different font. Do you mean to track *all* possible formatting of *each* character in *every* cell, and determine whether the same data needs to be formatted the same way in some other row after reordering? That would be a horrendous job. It could be simplified if you assume that whatever formatting is applied to the first character of the cell will be applied to the whole cell; then it's a little more complicated than applying a style, but still not too bad. (In fact, you could define a new character style to match that first character, and then apply that to the whole cell.) -- Regards, Jay Freedman Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word
Quote: > What you're talking about is not "style" but "direct formatting." Ordinarily > I would say this was *more* likely to be retained than a style, but if > you're round-tripping it through a UserForm, I think you'll find you lose it > without extra VBA to retain it. For this reason, you're more likely to get > the answer from one of the VBA gurus. > -- > Suzanne S. Barnhill > Microsoft Word MVP > Words into Type > Fairhope, AL USA
> > Hello all > > Wasn't sure where to post this as I think it's somewhere between tables > and > > userforms. > > Using Windows 98, Office 97 SR-2. > > I have a template which creates a document with a table of data based on > the > > output from a userform. Users can edit the data in the table by clicking > a > > toolbar button, upon which event a new userform is created, extracting the > > data from the table to allow editing. When the user has finished making > > changes, the table is deleted and a new one created to hold the new data. > > (The reason for deleting and recreating the table is that there are not > > guaranteed to be the same number of rows in the new table and the order of > > the data may be altered or the data may be deleted) > > I would like to know if there is a way of retaining any style/font changes > > that have been made to the data in individual cells, e.g. if the user > > manually selects the contents of the first cell and makes the text bold > and > > underlined can this be retained with the text? I guess I'm asking if > there > > is any way to record the style properties of a cell's contents so that, > when > > the data is added to the new table, any original text retains it's style? > > Any help would, as always, be gratefully received. > > -- > > Denise Crawley
|
Fri, 09 Apr 2004 22:32:30 GMT |
|
 |
Denis #4 / 5
|
 Retaining styles in table cells when deleting table
Thanks for that, Jay. It's got the old braincells ticking along nicely now. Unfortunately, I do need to go down the "direct formatting" path (I really should learn the correct terminology for things in Word...) but I think I can get away with assuming that the formatting will be the same throughout the entire cell. I've come up with the idea of putting a marker in the array that holds the table's data, so that I can record what formatting has been applied to each cell (e.g. bold, bold underline, etc.). I do need the formatting to "follow" the data to its new location - the data may or may not end up in the same cell. Fortunately, only the basic formatting "styles" will be used as we're very strict on heading styles, etc. If anyone decides to add their own formatting I will, indeed, be in deep doodoo ;o) Thanks again -- Denise Crawley
Quote: > Hi, Denise, > I'll preface this by saying that almost *anything* is possible if you're > willing to put enough effort into it. To quote an old chestnut, though, just > because something can be done doesn't mean it should be done. > If the applied formatting really was a style, as set up in Format/Style > (either a paragraph style or a character style, but you'd need to require > that it be applied to the entire cell), then it would be fairly simple to > record the name of the style and reapply it to the same cell(s). Then the > complications start... If the rows are reordered, do you want the style to > stay with the data, in which case you'd have to track its new position, or > do you want it to be in the same cell but with the new data? Either way, > it's possible and not terribly difficult. > If the formatting is direct, the way you described it, then you're in deep > doodoo. Direct character formatting can be done character by character -- > for example, the third character could be made bold, the fourth one bold and > underlined, and the fifth one in a different font. Do you mean to track > *all* possible formatting of *each* character in *every* cell, and determine > whether the same data needs to be formatted the same way in some other row > after reordering? That would be a horrendous job. It could be simplified if > you assume that whatever formatting is applied to the first character of the > cell will be applied to the whole cell; then it's a little more complicated > than applying a style, but still not too bad. (In fact, you could define a > new character style to match that first character, and then apply that to > the whole cell.) > -- > Regards, > Jay Freedman > Microsoft Word MVP Word MVP FAQ site: http://www.mvps.org/word
> > What you're talking about is not "style" but "direct formatting." > Ordinarily > > I would say this was *more* likely to be retained than a style, but if > > you're round-tripping it through a UserForm, I think you'll find you lose > it > > without extra VBA to retain it. For this reason, you're more likely to get > > the answer from one of the VBA gurus. > > -- > > Suzanne S. Barnhill > > Microsoft Word MVP > > Words into Type > > Fairhope, AL USA
> > > Hello all > > > Wasn't sure where to post this as I think it's somewhere between tables > > and > > > userforms. > > > Using Windows 98, Office 97 SR-2. > > > I have a template which creates a document with a table of data based on > > the > > > output from a userform. Users can edit the data in the table by > clicking > > a > > > toolbar button, upon which event a new userform is created, extracting > the > > > data from the table to allow editing. When the user has finished making > > > changes, the table is deleted and a new one created to hold the new > data. > > > (The reason for deleting and recreating the table is that there are not > > > guaranteed to be the same number of rows in the new table and the order > of > > > the data may be altered or the data may be deleted) > > > I would like to know if there is a way of retaining any style/font > changes > > > that have been made to the data in individual cells, e.g. if the user > > > manually selects the contents of the first cell and makes the text bold > > and > > > underlined can this be retained with the text? I guess I'm asking if > > there > > > is any way to record the style properties of a cell's contents so that, > > when > > > the data is added to the new table, any original text retains it's > style? > > > Any help would, as always, be gratefully received. > > > -- > > > Denise Crawley
|
Sun, 11 Apr 2004 19:44:01 GMT |
|
 |
Steve Hudso #5 / 5
|
 Retaining styles in table cells when deleting table
You could try saving the ranges, that should save text + styling. Steve H. On Mon, 22 Oct 2001 11:12:48 +0100, "Denise" Quote:
>Hello all >Wasn't sure where to post this as I think it's somewhere between tables and >userforms. >Using Windows 98, Office 97 SR-2. >I have a template which creates a document with a table of data based on the >output from a userform. Users can edit the data in the table by clicking a >toolbar button, upon which event a new userform is created, extracting the >data from the table to allow editing. When the user has finished making >changes, the table is deleted and a new one created to hold the new data. >(The reason for deleting and recreating the table is that there are not >guaranteed to be the same number of rows in the new table and the order of >the data may be altered or the data may be deleted) >I would like to know if there is a way of retaining any style/font changes >that have been made to the data in individual cells, e.g. if the user >manually selects the contents of the first cell and makes the text bold and >underlined can this be retained with the text? I guess I'm asking if there >is any way to record the style properties of a cell's contents so that, when >the data is added to the new table, any original text retains it's style? >Any help would, as always, be gratefully received.
|
Sun, 25 Apr 2004 09:34:10 GMT |
|
|
|