Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

XPS - WPF Guru's Please Help!

Closed Thread
 
Thread Tools Display Modes
Old 11-21-2006   #1 (permalink)
Sir C4
Guest


 

XPS - WPF Guru's Please Help!

Can anyone provide a c# example of how I can copy / reuse XPS
resources? In creating a "template" system, I'm trying to: 1) read an
XPS document; 2) replace place-holder text with actual text; 3) write
new XPS document.

My works so far leave an XPS document that when opened gives the error
"AddFontResourceEx failed"

Any help would greatly be appreciated.

Old 12-10-2006   #2 (permalink)
Chad Z. Hower
Guest


 

Re: XPS - WPF Guru's Please Help!

Sir C4 wrote:
> Can anyone provide a c# example of how I can copy / reuse XPS
> resources? In creating a "template" system, I'm trying to: 1) read an
> XPS document; 2) replace place-holder text with actual text; 3) write
> new XPS document.


It this of any use? Its from the Vista Launch material:

pkg = Package.Open(stm);
foreach (PackagePart part in pkg.GetParts())
{
Debug.WriteLine(part.Uri + " (" +
part.ContentType + ")");
if (part.ContentType == "image/png")
{
using (Stream imgStream = part.GetStream())
{
Image img = new Image();
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.StreamSource = imgStream;
bmp.EndInit();

img.Source = bmp;
img.MaxWidth = 200;

imagesList.Items.Add(img);
}
}
}


--
Chad Z. Hower
Microsoft Regional Director
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professional technical speaker at your event?
http://www.woo-hoo.net
Old 12-10-2006   #3 (permalink)
Chad Z. Hower
Guest


 

Re: XPS - WPF Guru's Please Help!

Sir C4 wrote:
> Can anyone provide a c# example of how I can copy / reuse XPS
> resources? In creating a "template" system, I'm trying to: 1) read an
> XPS document; 2) replace place-holder text with actual text; 3) write
> new XPS document.


It this of any use? Its from the Vista Launch material:

pkg = Package.Open(stm);
foreach (PackagePart part in pkg.GetParts())
{
Debug.WriteLine(part.Uri + " (" +
part.ContentType + ")");
if (part.ContentType == "image/png")
{
using (Stream imgStream = part.GetStream())
{
Image img = new Image();
BitmapImage bmp = new BitmapImage();
bmp.BeginInit();
bmp.StreamSource = imgStream;
bmp.EndInit();

img.Source = bmp;
img.MaxWidth = 200;

imagesList.Items.Add(img);
}
}
}


--
Chad Z. Hower
Microsoft Regional Director
"Programming is an art form that fights back"
http://www.KudzuWorld.com/
Need a professional technical speaker at your event?
http://www.woo-hoo.net
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
A call for help from the PC guru's out there... RyanGraubner General Discussion 4 02-24-2008 12:37 PM
Imaging a Vista Installation - Question for the guru's - imagex BobS Vista installation & setup 11 02-18-2007 05:43 AM
Win XP, OS X x86, Vista 5365 - How to install them all? BCDEdit guru's out there? Noozer Vista General 12 05-08-2006 04:38 PM
Win XP, OS X x86, Vista 5365 - How to install them all? BCDEdit guru's out there? Noozer Vista installation & setup 12 05-08-2006 04:38 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50