What we need from Excel

D

David Thielen

Hi;

Some of this is repeats from below but I wanted to get everything in one list:

First off, this is for XLSX files only. It would be nice if it works for XLS
files too but that is not required.

Second, our AddIn needs to work with Excel 2000, 2002, 2003, & 2007 so any
solution needs to work on all 4. It's fine if I have to write different code
for each. And if there is just no way to do it on Excel 2000/2002 we might be
able to drop those two.

1) Attach our data to the file so that when we read in the file we can read
our data and when the file is saved, it saves our data with it. This data is
a single string that is a uuencoded set of data and is usally 5K - 20K long
but can be several hundred K in size.

2) Determine where the caret is and what text is selected when editing the
text of a cell.

3) Set some/all text in a cell while it is being edited. It's fine if we
always have to set all as we can read the cell text, replace the chunk we
want, and then write it all.

Note: On Excel 2007 at least it appears to be fine for our AddIn to be
called while editing a cell - it can read the cell contents fine. Writing
them appears to be ignored if we use Range.Value2 = "hi there";

4) Same question as (2) and (3) for comments - the ability to determine
where the caret is in them, what text is selected, and writing a new value
while the caret is editing them.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
D

David Thielen

Hi;

To give some context to (2) & (3) - we want to let a single cell hold
multiple tags so it could be:

<wr:forEach select="..."><wr:eek:ut select="..."/>

And we then bring up our editor for the tag the caret is on to edit/delete
that tag. And if the caret is before/after a tag, we then let them insert
another tag at that point.

For item (3) - we may want to support tags in the comment field too.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

Jialiang Ge [MSFT]

Hello Dave,

I watched your product's demo at
http://www.windwardreports.com/mktg/Videos/AutoTag_Intro/AutoTag_Intro.html,
and now I am having a clearer picture of your situation.

Q1) Attach our data to the file so that when we read the file we can read
our data and when the file is saved, it saves our data with it. This data
is
a single string that is a uuencoded set of data and is usally 5K - 20K long
but can be several hundred K in size.

Answer:
Besides the custom properties, another workaround is to create a temp
worksheet (workbook.Sheets.Add) in the workbook, and hide the worksheet
(sheet.Visible = Excel.XlSheetVisibility.xlSheetHidden). Then we could
store the custom data in the temp worksheet's cells.

Q2) Determine where the caret is and what text is selected when editing
the text of a cell.
Q3) Set some/all text in a cell while it is being edited. It's fine if we
always have to set all as we can read the cell text, replace the chunk
we want, and then write it all.
Q4) Same question as (2) and (3) for comments - the ability to determine
where the caret is in them, what text is selected, and writing a new value
while the caret is editing them.

Answer:
We do not find a direct method to get the selected text or insert text at
the current caret in a Excel worksheet cell/comment when the cell/comment
is in edit mode:
1. Excel object model does not expose an access to it.
2. We tried to use Windows API SendMessage WM_GETSEL to the cell's textbox.
But unfortunately, when a cell is in edit mode, the textbox around the cell
is not a window. GetForgroundWindow API returns the window of the whole
worksheet. Therefore, we are not able to get the handle of the text box and
the message WM_GETSEL is not sent to the cell successfully.

However, for your specific question, a possible workaround is:
When users decide to edit the cell's tags, we could ask users to click on a
command bar button of your add-in, then show a form in which we read the
cell's current text to a winform TextBox control. Then we can get the
selected text/ insert text in this winform textbox by calling:
textBox1.SelectedText and textBox1.Text =
textBox1.Text.Insert(textBox1.SelectionStart, "insert text"); After the
edition is finished, we write the textBox1.Text to the cell's Value2
property or Comment property. Hope it helps.

If you have any other concern, please feel free to let me know.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
For MSDN subscribers whose posts are left unanswered, please check this
document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express/Windows Mail, please make sure
you clear the check box "Tools/Options/Read: Get 300 headers at a time" to
see your reply promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jialiang Ge [MSFT]

Hello Dave,

The Excel product team has informed me that we are not able to manipulate
the text of cells in edit mode directly. Unfortunately the design of the
edit mode does not fit your request. I have submitted your concern to our
internal log for future design reference. I am sorry we cannot help you
with this issue but If there is anything else I can do for you, please
feel free to let me know.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top