Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 445
  • Last Modified:

VB 2005 VSTO: Display part of a managed spreadsheet within a form.

Hi

Is it possible to display part of a managed Excel spreadsheet
within a Windows form.

Thanks

0
Murray Brown
Asked:
Murray Brown
  • 6
  • 6
1 Solution
 
newyuppieCommented:
you would need a 3rd party tool to show it exactly like a spreadsheet. a workaround could be to store the cell values in a datatable and show them in a datagridview.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi Thanks

I actually just need it to show a single cell (or maybe 16 cells), to show the effects of different
combined formatting.

If the user chooses to format say borders and the color of the font, I want the cell to show the combined effect.

Thanks

0
 
newyuppieCommented:
there is another simpler option if it suits you. you could open an instance of excel from VBNET and do your formatting directly in a new Excel spreadsheet by using the interoperability inherent to .net
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
AndyAelbrechtCommented:
another solution might be to use the activex Excel object which is meant for websites; this component gives you access to nearly all of Excels functionality and you can put it in your project. it even acts almost completely the same as a real Excel.exe !

I've used this extensively in one of my projects and I have to say this works nicely.

if you need any help locating the control or have some example code, just lemme know; I have a bunch of example code about it :)

hope this helps a bit,
Andy
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi thanks

newyuppie: is there a way that you could see a few cells of a managed spreadsheet within a form?

AndyAelbrecht: would it be possible to give me an example
0
 
newyuppieCommented:
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi newyuppie. Which topic on that page?
0
 
newyuppieCommented:
check the "How To: Refer to Worksheet Ranges in Code", and the "Apply styles to Ranges in Worksheet"

http://msdn2.microsoft.com/en-us/library/1ad4d8d6(VS.80).aspx
http://msdn2.microsoft.com/en-us/library/f1hh9fza(VS.80).aspx
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Great thanks
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Incidentally. Is there a way to copy the formatting applied in one spreadsheet to that in another.  I could have my users format a test area in the managed spreasheet project, that would be copied to the specified range at runtime.
0
 
newyuppieCommented:
thanks for the points.
following this link: http://msdn2.microsoft.com/en-us/library/f1hh9fza(VS.80).aspx
"How to Apply Styles to Ranges in Workbook"
for example have your users select the formatting they want, and then you can create a new style based on that formatting:


Dim style As Excel.Style = Globals.ThisWorkbook.Styles.Add("NewStyle")
style.Font.Name = "Verdana"
style.Font.Size = 12
style.Font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red)
style.Interior.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Gray)
style.Interior.Pattern = Excel.XlPattern.xlPatternSolid

then to copy this style to a range
Dim rng As Excel.Range = Me.Application.Range("A1")
rng.Style = "NewStyle"



0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Excellent. Thanks very much for that. Really appreciate the added help.
0
 
newyuppieCommented:
sure, if you have any more problems post them here anyway.
NY
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now