Quantcast
Channel: SoftArtisans
Viewing all 140 articles
Browse latest View live

What’s New in OfficeWriter 8.6

$
0
0

64-bit Support in OfficeWriter Designer

OfficeWriter 8.6 marks the initial release of the OfficeWriter Designer .NET, a redesign of the original OfficeWriter Designer, using the latest technologies and best practices.

DesignerdotNetRibbon

The OfficeWriter Designer .NET is available for both 64-bit and 32-bit Excel and includes:

  • Better user experience with updated dialog boxes
  • Improved access to Report Properties
  • Stronger support for viewing reports with parameters
  • New import template functionality (also available in the original OfficeWriter Designer)

DesignerDotNetNewDialogs

The Designer .NET does not currently have full backwards compatibility with the original OfficeWriter designer. To find out if the Designer .NET will support your reports, review our quick guide or read about all of the differences in full in our documentation.

The OfficeWriter Designer .NET is available for download from our product updates page or through our evaluation sign-up.

Classic Pivot Tables

Starting in OfficeWriter 8.6, you can create PivotTables with the classic grid layout using the PivotTableSettings.ClassLayout property. This is the same as setting the classic layout property under PivotTable options.

PivotTable_Reg

Original PivotTable – available in 8.4.

PivotTable with Classic Layout enabled - available in 8.6

PivotTable with Classic Layout enabled – available in 8.6

 

Sparklines for ExcelTemplate

Sparklines are a simpler way to graph trends without the overhead of creating a full chart.

Sparklines

Now ExcelTemplate will update the data sources of any sparklines that point to data markers to reflect the new data that is being imported. If a sparkline is in the same row as a data marker, the sparkline will be copied for each new row.

Sparklines3

To learn more about this new feature, check out our previous post.

Other Highlights

  • Reduced memory required to open files with large numbers of formulas
  • New save method for ExcelTemplate and ExcelApplication for better integration with .NET MVC applications
  • …and more!

For a full list of changes made to OfficeWriter in 8.6, please see the product change log.


  OR 


// ]]>


Stories from the WIT Trenches: Laura Wallendal

$
0
0

[Stories from the Women in Tech Trenches is a series of posts exploring the personal stories of real women in technology. Every woman in tech overcame, at the very least, statistical odds to be here; this blog series aims to find out why, and what they found along the way. This week we met up with Laura Wallendal, Co-Founder and COO of EdTrips. EdTrips is a travel company centered around the school field-trip process and keeping the focus on learning rather than logistics. With a background in languages and art history, Laura found that fusing the tech world with her passions of travel and education could create meaningful strides in the classroom. Laura shows that the tech trenches are not solely relegated to those within the math and science fields. If reading her story inspires you to share yours, please email me.]

Laura Wallendal

I’m the Co-Founder and COO of EdTrips, an edtech and travel company.  Originally from Friendship, Wisconsin, I moved to Boston in 2004 and co-founded EdTrips in 2011 after years of experience in the educational travel industry. At EdTrips, I head up strategic partnerships and business development.

Questions:

1. Can you take us back to your “eureka!” moment—a particular instance or event that got you interested in technology?

It wasn’t until after training for my first mud run obstacle course in 2010 that I became interested in solving problems with technology.  I wanted a way to coordinate with other people who had the same interest in crazy obstacle course events. That led me to create my first website. At the same time, I was working in the educational travel industry and seeing a lot of ways that things could be done better—for instance, the basic ways in which travel was booked. Solving a problem using technology for my personal interests gave me the confidence to begin tackling those problems I saw in educational travel, and begin seeing that I could start to solve them.

2. Growing up, did you have any preconceived perceptions of the tech world and the kinds of people who lived in it?

No. I wasn’t really exposed to the tech world until I got to college. Growing up in rural Wisconsin, I was one of the first kids in my grade to have a home computer, and our family had internet access before my elementary school even did, so technology wasn’t a focus in the community.  Given my tech-sheltered past, I never imagined starting a tech company.

3. You co-founded EdTrips in 2011, and since it’s been a way to integrate technology within the classroom. Can you tell us a little about EdTrips and the company’s overall mission?

EdTrips is a tool to streamline planning and managing school travel. Whether a field trip, overnight trip or overseas trip, EdTrips is an open and flexible platform that decreases the workload for the trip organizer. It handles everything from payment collection to forms, so travelers and educators can focus on learning, not logistics. It’s our mission to make travel a part of everyone’s education.

4. What was the inspiration behind EdTrips?

After working for a large educational travel company, I moved on to do consulting for 3 small travel abroad companies.  Doing sales and business development for both large and small companies, it was evident that trip organizers were in need of a solution to help manage travel online, the way individual travelers have so many tools to use. Doing payment collection by hand, managing accounting and recruiting travelers with spreadsheets and inviting people with emails, phone calls and flyers is time consuming and we knew there had to be a better way.

5. What led you to this career path? When did you first start working with tech? Was it by choice?

After realizing the work I was doing with teachers and schools could be done better with technology, I immediately called a friend from college for advice.  He recommended I look into building a platform using Ruby and made introductions to several development shops around town to get quotes and find that sweet spot for our Minimum Viable Product.  I gave myself a crash course in a new way of thinking and solving problems. I was hooked!  It was absolutely by choice and now I could not see myself doing anything else.

6. Did you experience any personal or systemic setbacks at any point of your academic or professional career?

Yes, I have faced both personal and systematic setbacks in my academic and professional career.

When I was in college, my younger sister passed away of Leukemia and my academic career was severely disrupted.  I took a semester off and transferred schools to be closer to home and got my higher education back on track.

When it came to looking for a job, like many recent grads, I found it a challenge to find what was right for me. Eventually I landed in sales for an educational travel company and found something I was truly successful at, enjoyed, and found rewarding. I was the top performing sales person on my team, but found the politics a turn-off. I switched teams and eventually decided to leave altogether and work for myself.

Through these setbacks, I never gave up.  Each time I faced a setback or adversity, I made a life change and gained the courage to continue. I consistently made changes both big and small to give myself the best chance at personal and professional success.

7. Whom do you look to as mentors and/or sources of inspiration?

Melissa Withers, the COO of the Betaspring accelerator

Halley Suitt Tucker, author of Founders Less Than Three

Arianna Huffington of the Huffington Post

My mom Paula

My dad Andy

My co-founder Jake Garrow

8. Do you have any suggestions for how to get more girls interested in technology? Is this important to you?

This is incredibly important to me!  Lowering the barrier to entry by giving more access to new technology projects and the women who help create them as early in girls’ education as possible is key.  A big part of it will be showing examples of how collaborative and creative the process is and highlighting examples of women in all types of leadership roles in technology companies.

9. Do you have any advice for women interested in tech/starting their own business?

Get rid of the idea of personal perfection. You don’t have to know everything you’ll need to know before you get started. When I look back at what I knew back when I co-founded EdTrips, I know I could have saved time and money by having had the knowledge and experience that I have now. However, there’s no better way to get the experience than jumping in feet first. If I didn’t take the leap, I wouldn’t have learned the things I know or met the people I have met. It’s about making mistakes until you get something right, and then continuing to make mistakes after that.  Get comfortable with failure and don’t be shy about not knowing how to do something. I’m more proud of my accomplishments and not at all ashamed of my shortcomings.

10. Do you have anything to add that you haven’t had a chance to mention?

I’m proud to have co-founded an edtech company with more women in leadership roles than we have men. I’m also proud to say the men on our team are incredible, smart, and supportive. Without everyone working together, we couldn’t be where we are today. Whether or not we maintain the ratio, I am seeing amazing things from both women and men in my industry.

Truth in Tech Ep 27: The Future of Advertising

$
0
0

Native ads. Brands as publishers. #BreakingBad. Target telling your dad you’re pregnant. Advertising may have lost its 3 martini lunches, but it’s gained a position at the forefront of both high-tech and narrative innovation. On this episode of Truth in Tech, we talk to Hill Holiday‘s Austin Gardner-Smith about the industry’s future, and the cultural and technological shifts behind it.

Truth in Tech E27- The Future of Advertising — Skimbox

Want to guest star? Have an interesting tech topic, startup, or story of the week? Email us at elisek@softartisans.com! Or find us roaming the Twittosphere @elisekovi and @clairedwillett.

Webinar: Ghouls, Goblins, and Data

$
0
0

Register for the October Webinar!

Learn how OfficeWriter can put data in the hands of your business users.

When: Friday, October 18th at 1 P.M.

In this webinar:

We’re looking at what the average American spends on Halloween each year from costumes to candy to decorations. Importing this data into Excel using OfficeWriter, we’ll see which costumes outrank the rest. Is it Miley Cyrus, your favorite decade garb, or the ever-popular witches and ghosts? We’ll find out, along with what Americans spend on these once-a-year ensembles, mounds of candy, and gobs of decorations. You’ll take away new tricks for creating reports in Excel and maybe a DIY Halloween costume idea or two.

What we’ll cover:

  • Building a report in SSRS from start to finish
  • Using charts and sparklines to display your data
  • Plotting multiple data sets on one graph
  • OfficeWriter’s new .NET designer ribbon for Excel




// ]]>

Meet the Team: Seth

$
0
0

Hello and welcome to our Meet the Team series, in which we aim to give you deeper insight into the minds and personalities of those who make up this eclectic, close-knit group. We are developers, marketers, and technical support engineers, and at work we craft everything from Microsoft reporting APIs to mobile email applications. And outside of work? Let’s just say racing against the machine during hackathons, building architecturally sound beer towers during retros, and paddling down the Charles during the warmer months are simply the beginning.

SethMeet Seth – our quality control man, subscriber of (and living) This Developer’s Life, most closely personified by a strong spring lager, and powerless to the smile a clever line of code brings.

1. What do you do?

I’m a software engineer on the OfficeWriter team, so I spend my days hunting bugs, implementing cool new features, and trying to come up with new products.

2. What are you listening to right now?

Lake Street Dive – Clear a Space

3. If you could build any app, what would it be and why?

A contact de-duplication/management app that actually works well.

Also a bus/train app that just shows all departure times at the nearest stop…why do I need to choose a stop? My phone knows where I am!

4. When you were 5 what did you want to be and why?

In my early years I wanted to be a nature and wildlife photographer, working for National Geographic.  I was always going around taking pictures of landscapes and animals.  On our family trips to national parks, my younger brother and I would always get as close as we could to the wildlife (including a grizzly bear once) to get a good photo.

5. If you were a beer what would you be and why?

Maibock, light and easy-going, but deceivingly powerful and complex.

6. What is your favorite tech blog and why?

Not really a blog, but a podcast, but This Developer’s Life.  It’s just too bad they’re so slow at making new episodes.

7. Fill in the blank. Contrary to popular belief I am not yet in my 30′s.

People must think I act old or something.

8. Describe your perfect Saturday afternoon in 10 words or less.

Taking a stroll outdoors during the golden hour.

9. When did you last laugh?

Reading xkcd on the train this morning.

10. Describe your personal style in one word.

Awesome.

11. What is your worst nightmare?

I’ve always had this irrational fear that my wife’s plane will crash when she’s on a business trip, so I save every voicemail she sends me while she’s gone. I guess I’m just a hopeless romantic.

12. If you were a superhero, what would be your superhero name/power?

My name would be Seth, and my power would be teleportation (with the ability to teleport anything/anyone touching me).  My power would be used solely for the purpose of going to work and visiting cool and exotic places on the weekends.  People would most likely hate me.

13. What 3 things would you bring to a deserted island?

  1. Large tarpaulin
  2. Knife
  3. Rope

I would plan on using my Eagle Scout skills to build a boat, catch some fish, and someday sail back to civilization.

14. Who would play you in a movie of your life?

Everyone says I look kind of like John Mayer.  I’m not sure I believe them, but it would be fun to see if he can act.

15. What is the last thing you bought?

Apple trees…seriously, two of them.

16. What are your biggest pet peeves?

I’m usually pretty easy-going, but improper use of turn-lanes (e.g. using them to pass everyone else) can get me riled up…good thing I ride the train!

17. Name something that makes you smile.

A clever piece of code, and a crisp fall day, and of course being with my family and friends.

18. If you could teach a college course what would it be?

Either embedded computing, computer architecture, or networking architecture.  In all of those classes I suddenly had this moment of understanding, and I think it would be awesome to be the one that guides people to that moment.

Creative ways companies are making use of Big Data

$
0
0

From art to cancer patient care, consumer goods to the NBA, Big Data is piling up and these companies are finding ways to make sense of it all. Scroll through the slideshow below to find out how.

Through the above examples of striking visualizations to interactive user experiences, we’re seeing companies and individuals find unique ways to leverage the data and insights being collected daily. How are you seeing Big Data used within your industry? Do you have any examples? Let us know!

Resources and Image Credit:
 “Growing Customer and Partner Successes Illustrate the Openness and
Impact of SAP HANA™ Across Enterprise Software”Press Release. www.SAP.com
Halverson, Nic (7 Oct., 2013)“Mouth-watering Maps Continue to Mine Big Data”. DiscoveryNews.com
Larson, Eric (25 Sept., 2013). 5 Ways Big Cities are Using Big Data.” www.Mashable.com
Madden, Sean (2 May, 2012). “How Companies Like Amazon Use Big Data to Make You Love Them”. www.FastCoDesign.com
Image Credit: www.NationalGeographic.com
Image Credit: www.stats.NBA.com

Truth in Tech Ep. 30: Crowdsourcing a Cure for Cancer

5 Ways to Make Programming Less of a Nightmare

$
0
0

Credit: HubSpot

Programming can be scary.  There are plenty of things that can go wrong, from haunting errors to seemingly supernatural result inconsistencies.   To help keep the ghosts in the machine from getting the best of you, here are some tips my co-workers and I have picked up over the years.

 

 1)  Make a rough draft

Just like writing a paper, programming requires some forethought.  When you’re given a new programming problem it is always tempting to start coding right away, especially if you are in a rush.  However, taking the time to make an outline of your program first will save you lots of headaches later.  Even if it is a seemingly simple problem, think about what methods and helper methods you are going to need, what variables they will take, and how they will interact.  It is generally easier to debug code errors than logic errors, so work out the logic as much as possible before starting to code.

2) Listen to music

Having also tried TV, audio books, and silence, the best way I have found to stay productive while coding is to listen to some upbeat music.  It seems I am not alone in this opinion, as the internet has many playlists labeled specifically for programming. (In fact, we have a few of our own you might like.)  Music drowns out background noise but can easily be tuned out, keeping you focused and helping the time go faster.  So to prepare for your next coding marathon just put on your headphones.  Before you know it you will be halfway through your code and typing in beat to the music.     

3) Follow good stylistic practices

This might seem like rudimentary advice, but anyone who has ever dealt with inherited code knows that it is not always followed.  Even though it seems like you are saving time it is never a good idea to take shortcuts and skip things like good comments, proper indentation, and meaningful variable and method names.  Following these practices makes your code far more readable and accessible.  You and anyone else who has to look at your code in the future will appreciate not having to reverse engineer the program to understand what it does.

4)  Ask other programmers

Sooner or later you are going to run into an error, but luckily you are not alone.  One of the best things about being a programmer is belonging to the global programming community.  Regardless of what error or trouble you are having with your code, there is almost certainly someone who has had that same problem and is willing to help you solve it.  These people could be your co-workers, classmates, teachers, or anonymous users on internet forums.  Thanks to all these helpful people there are plenty of places to find answers, and more often than not they can be found with a quick Google search.

5)  Stop thinking about it

If you’ve been working on the same bit of code for 5 hours with no results, trying the same thing for another hour is not going to get you anywhere.  The best thing you can do is take a break.  Take a nap, get some coffee, watch TV – whatever will get your mind going in a different direction.  I have found that it is not uncommon for the solution to suddenly occur to me while I’m away from the computer.  Even if your break does not lead to an epiphany, it will make you more productive when you return to your code.

So the next time your code is giving you a run for your money, don’t go screaming in the other direction. Take a look back at these tips to get you back on track.

Need some coding inspiration? Take a look at our playlists to find your programming groove.


Weekend Reading: What You Should Be Reading this Weekend

$
0
0

Credit: HubSpotNews that should be taking up space on your online reader, Kindle, iPad, or other miscellaneous gadgetry.

Data, Data, Data
Public Health: How Does the UK Compare with Europe? Interactive Map
Source: The Guardian
The Guardian‘s Data Blog produces interactive maps and images to visualize interesting data sets. This week they tackled life expectancies and overall health in the UK relative to Europe.

Gadgets
A Gestural Interface for Smart Watches
Source: MIT Technology Review
Researchers at the University of California at Berkeley and the University of California at Davis are developing a tiny chip that detects gestures in 3D. The chip is called Chirp, and its goal is to bring gesture controls to an array of devices, including wearable technology such as smart watches.

Startups
Circle Raises $9 Million Series A from Accel and General Catalyst to Make Bitcoins Mainstream
Source: TechCrunch 
Will Bitcoins make it after all? Circle, a Boston-based company, is a platform designed to make trading Bitcoin and other digital currencies easier. This is among the highest Series A funding received by startups in the digital currency space so far. See who invested and what this means for the company.

Events
One Million Kids Have Signed Up for the Hour of Code. Let the Geeking Out Commence.
Source: PandoDaily
Mark your calendars for December 9th – 15th, as the week of Computer Science Education begins. During that time, Code.org is hosting an Hour of Code, encouraging students to dig into computer programming. At the helm of the workshops are big tech names like Mark Zuckerberg and Bill Gates. With just 16 days since the first announcement, 1 million kids have registered.

Privacy
Angry Over US Surveillance, Tech Giants Bolster Defenses
Source: The New York Times
Still experiencing fall-out from the NSA PRISM scandal, tech giants such as Facebook and Twitter are implementing new methods to encrypt user data. See the measures they’re taking to regain trust among their user base.

Video
Can Technology Solve Our Big Problems?
Source: TED Talks
Jason Pontin, editor-in-chief and publisher of MIT’s Technology Review, outlines the challenges of using technology today to solve the world’s biggest quandries.

And because we’re a little biased….
Scenes from a World Series Celebration
Source: Boston Magazine’s Extra Bases series

Go Sox! Now, go forth and enjoy the weekend.

Thinking Outside the Spreadsheet Box: Unexpected Uses of OfficeWriter

$
0
0

If you leave me alone for too long, I do foolish things like make a mini-paint app that writes the image to 1×1 cells in Excel. And so can you! But before I show you how to make a mini-paint app (the easiest thing you will ever do in your life), let me explain to you what part of me said, “Yeah, Champ, this is a great idea! Who wouldn’t want to make a weird spreadsheet that contains an image made with the background color on cells?” It all began when I was thinking about this awesome idea by my art crush, Evan Roth (*swoon*). He said, “Hey world! I want work to be art,” and decided to make a double-mouse that outputs to an art program on one screen and his regular work on the other. So I figured, why not put some art in Excel too?

Then I got more and more excited as I realized there are actually a ton of cool things you can do…

  • Use the formulas in Excel as transformations on your picture.
  • Randomize cell size to introduce weirdness.
  • Flip the project to input an Excel template and output an image, using Excel calculations and System.Draw to make a simple ray tracer.
  • Do some stuff with conditional formats, or all those light transform equations you learned in high school for no reason…until now!
  • Make a mock tool that lets users draw a spreadsheet design and output it to a real spreadsheet! (I thought a lot about this, and it’s not necessarily simple, but it is a really cool idea. If anyone puts that together, please let me know. I mean you, Evan Roth….Call me?)

The Mini-Paint

For the sake of simplicity, I’m showing you the randomized cell idea. I’ve made it an optional setting in this example, but, you know, make it your own and all. Oh, also, get at me with your art! For this app you’ll need WinForms and OfficeWriter.

appwindow

I started by making a pretty basic app that has some simple actions. The “canvas” is a PictureBox that I save and resave some drawing objects to on each mouse event. The color selector is just 8 flat buttons set to be the color they represent. The shapes are again flat buttons with Wingdings images because I was too lazy to find a relevant .res file with some neat picture icons. Can you guess what the size toggles are? Flat buttons. Generic plus/minus from your plain boring keyboard. Okay. Basic functions.

  • MouseDown sets a pointer location.
  • MouseUp nullifies the pointer location.
  • MouseMoved is a basic drawing function. (You can find a ton of examples, but I like this one from good ol’ SO.)
  • Color buttons set a global variable, _selectedColor, to the color of the button.
  • Shape button clicks set a global variable called _selectedShape. I set it to an enum of possible shape options and I use a switch statement in the draw method. Instead of calling DrawLine or DrawRectangle, I call DrawShape(x,y) with x and y being current mouse x and y.

DrawShape is roughly this:
Graphics graph = Graphics.FromImage(pbCanvas.Image);
Rectangle rect = new Rectangle();
switch (_selectedShape)
{
case PossibleShapes.Circle:
rect.Width = rect.Height = _size;
graph.DrawEllipse(pen, rect);
break;
case PossibleShapes.Rect:
rect.Width = _size + (_size/2);
rect.Height = _size;
graph.DrawRectangle(pen, rect);
break;
case PossibleShapes.Square:
rect.Width = _size;
rect.Height = _size;
graph.DrawRectangle(pen, rect);
break;
case PossibleShapes.Line:
pen.Width = _size;
pen.EndCap = System.Drawing.Drawing2D.LineCap.Triangle;
pen.StartCap = System.Drawing.Drawing2D.LineCap.Triangle;
graph.DrawLine(pen, rect.Location, new Point(x+3, y));
break;
case PossibleShapes.Tri:
Point[] triangle = new Point[3];
triangle[0] = new Point(x,y);
int width = x + _size;
triangle[1] = new Point(width, y);
int angle = (x + width)/2;
int angleHeight = y - _size;
triangle[2] = new Point(angle, angleHeight);
graph.DrawPolygon(pen, triangle);
}

The most basic shape options.

You may have noticed “Toggle Fill” on the app. I did that for ease. I didn’t want to have a filled triangle, open triangle, filled circle, open circle…etc in the shape buttons box. It would look cluttery and make my enum GIGANTIC.  My logic was that each shape could be set to a PossibleShape value, and then based on a separate Boolean this could be called:

if (fill)

graph.FillRectangle(pen, rect);

Easy, and it keeps the switch manageable. Since everything except the triangle is based on the same method-scoped Rectangle, I can just call that statement almost shape-agnostically. The last step is to see if Triangle is the selected shape, in which case use graph.FillPolygon. Depending on your aliasing and where you declare your fill, you may want to call graph.FillEllipse if you’re filling a circle. It still takes rect as an argument though.

Of course there’s also a reset button, which sets the “canvas” back to white and resets all the globals back to default.

Making a paint app with only features you want is a breeze.

Now. On to the Excel part. The code for this is actually pretty simple. The Randomize checkbox and Generate buttons both use ExcelWriter objects.

The Generate and Randomize methods:
private void btnGen_Click(object sender, EventArgs e)
{
if (pbCanvas.Image != null)
{
//Disable the buttons, since this part can take a while
ToggleBtns(false);
//Get the image from the canvas
Bitmap inputImg = new Bitmap(pbCanvas.Image);
//Get your ExcelApp objects together
ExcelApplication _xla = new ExcelApplication();
Workbook wb = _xla.Create(ExcelApplication.FileFormat.Xlsx);
Palette pal = wb.Palette;
Style cellStyle = wb.CreateStyle();
Worksheet ws = wb.Worksheets[0];
//Make the pixels into cells!
for (int x = 0; x < inputImg.Width; x++)
{
for (int y = 0; y < inputImg.Height; y++)
{
System.Drawing.Color clr = inputImg.GetPixel(x, y);
//don't bother setting white - it's the default background color.
if (clr != System.Drawing.Color.White)
{
ws.Cells[y, x].Style.BackgroundColor = pal.GetClosestColor(clr);
}
//Create an area and set the cells to 1x1
Area area = ws.CreateArea(0, 0, inputImg.Height, inputImg.Width);
area.AllColumnWidths = 1;
area.AllRowsHeight = 1;
//If you're randomizing, call the random method
if (_rand)
{
Randomize(area, inputImg.Width, inputImg.Height);
}

//Save wherever. This is a nice place to add a save
//prompt, but I don’t care enough
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
_xla.Save(wb, desktop + “\\NewArt.xlsx”);

//All done!
MessageBox.Show(“Finished!”);

//Here are your buttons
ToggleBtns(true);
}
else
{
MessageBox.Show(“Dude. Draw something”);

}
}

private void Randomize(Area area, int x, int y)
{

Random rand = new Random();

//I don't want to change any more that 50 rows or columns
//The upper limit is up to you
//I also don't want rand to return 0 and look like it's broken
//The lower limit is up to you too!
int max = rand.Next(5, 50);
for (int i = 0; i < max; i++)
{
 //50/50 chance of changing row or column (in theory)
 //The math doesn't actually work out that way, I don't think
 //Something about the impossibility of true randomness?
 //Anyway, this is probably the closest you can come.
 if (rand.NextDouble() < 0.5)
 {
area.SetColumnWidth(rand.Next(x), rand.Next(2, 20));
}
 else
 {
area.SetRowHeight(rand.Next(y), rand.Next(2, 20));
}
}
}

Don’t use magic numbers in your code. I did it because this isn’t going into production. Make some nice “UpperBound” and “LowerBound” constants. Yep. Like that!

I used GetPixel, even though it’s slower. The reason I used GetPixel even though it’s slower is because I don’t understand enough about LockBits and stride to confidently explain the faster method to you. You can read a little here, but it’s beyond the scope of this anyway.

I also recommend disabling buttons or maybe having a timer icon, since you’re setting a style on 90,000 cells for an image that’s 300×300 pixels. I also recommend keeping the canvas small, because you’ll get an out of memory exception if you’re not careful.

And this is the button toggle. You might want to add some error handling, but just don’t like… explicitly set each value for each button… this will work, guys. Keep it simple. Keep it safe. (Wait, that’s “keep it secret, keep it safe,” right? I guess technically it works both ways.)
private void ToggleBtns(bool enable)
{
var controls = this.Controls.OfType<Button>();
foreach (Button ctrl in controls)
{
ctrl.Enabled = enable;
}
}
Okay. Generate. Here are some of my favorite transforms…

I made this eye:

OriginalEye

And the transform made this weirder eye:

eyetransform

Or this slinky ocean:

slinkyocean

That became this neat 1960s dress fabric:

60sfabric

Or even this cube-y thing:

stupidsquares

That became this desktop wallpaper:

background

You basically can’t live without this if you design fabric or desktop backgrounds, especially if it’s 1965. It’ll be so cool. Everyone will ask you, “What’s a desktop background?” and then you’ll answer back, “Look at this fabric I made!”

Anyway, go make your own art!

(That means you, Evan Roth.)

(*swoon*)

RetroTech Vol 1: Yuri Broze, Datasciencehead at Nomi

$
0
0

[Welcome to RetroTech, a joint blog series with Skimbox, where we journey back in time to an era of floppy disks, the Atari 800, and that unmistakable clicking sound of dial-up. We're digging up the good ol' days with interviews from tech's most staunch patrons and giving you a glimpse of their technological firsts.]

Interviews with TechFrom Proust and his madeleines to Buzzfeed and early Britney, if there’s one thing that unites us, it’s our shared affection for nostalgia. And tech nostalgia is, at least in our opinion, a particularly rich strain, because it combines memories with cluck-tongued humor. So we decided to mine it with RetroTech, an interview series about personal technological firsts.

To kick of the series, we turned to Yuri Broze. Yuri is a number of things, including: maestro of the right and left brains, unicyclist, pianist, and world-class whistler. He may not be the only data scientist with a PhD in Music Psychology, but he is the only one we know.

First screen name: dkcrulz. Short for “Donkey Kong Country Rules.” Yuri picked it up at age 11, in 1994, right after Donkey Kong Country came out.

First email address: dkcrulz@aol.com.

First computer: An IBM Compatible running MS DOS. “I would write poetry on it and have every other line come back ‘bad command or file name.’”

First video/computer game: Lemonade Stand for Apple 2. (Ed — this looks like the least fun computer game ever, and I say that as a person who wrote an execrable version of Pong.)

First cellphone: A Motorola Microtac (“grey all the way”) Yuri inherited from his mom.

Eureka “I want to work with computers” moment: Occurred during Yuri’s doctoral program in Music Psychology (“it wasn’t pushing my buttons”). Incredibly/encouragingly, Yuri only began to program seriously 3 years ago, thanks to his “sensei,” David Huron.

First programming language: Logo, specifically its graphic reptile arm, Logowriter. Yuri learned to make the turtle move in first grade.

First wired job: In high school, Yuri worked in a biochemistry lab at Wash U.

Create your Holiday Cards with OfficeWriter, The Sequel

$
0
0

seasonsgreetingsThe holiday season is back! Stores are stocking their shelves with the season’s must-haves and calendars are quickly filling up with travel and office parties. With all the hustle, bustle and festivities, occasionally sending out those holiday cards and thank-you notes get lost in the tinsel and taffeta. Well, you’re in luck, because this year we’ve put together a project for you to easily send out holiday thank-you notes and cards the nostalgic, old-fashioned way.

Last year, Sam showed us how to Automate Your Holiday Cards with OfficeWriter, and this year we’ve added thank-you notes to the mix. So you can spend less time on holiday prep and more time on the things that matter most – friends and family.

Using a few built-in tools with the .NET Framework, OfficeWriter, and templates, you can personalize every card for each one of your friends and family. See the example below. Then make your own by following these steps:

STEP 1 – DOWNLOAD OFFICEWRITER:

To get started, you will need to have OfficeWriter installed in order to be able to use the sample code below. In my solution, I used OfficeWriter and its built-in WordTemplate functionality to do a server-side mail merge. If you do not have OfficeWriter, you can download a free evaluation here.

STEP 2 – DOWNLOAD SAMPLE CODE:

Next, you will need the sample code. Download the sample solution here. This solution comes bundled with:

  • Sample code
  • Easily modifiable templates for holiday cards, mailing labels, and thank-you letters.
  • Dummy data from a Gmail Contact Export

Open the solution, run the generator, and you can see the three items:

SAMPLE OUTPUT:

SAMPLE CODE:

OfficeWriter makes it easy to generate the finished holiday cards, labels, and thank-you cards. With about 5 lines of OfficeWriter code for each template, within minutes you can go from nothing to a finished, picture-perfect file. The sample code below is a simple way to parameterize the code to handle all of our template files.

<br />
        private void GenerateCards()<br />
        {<br />
            GenerateOutput(&quot;\\Templates\\HolidayCards.in.docx&quot;, DataGenerator.GetContacts(), &quot;GreetingCards.docx&quot;, false);<br />
        }</p>
<p>        private void GenerateLabels()<br />
        {<br />
            GenerateOutput(&quot;\\Templates\\Labels.in.docx&quot;, DataGenerator.GetContacts(), &quot;Labels.docx&quot;, false);<br />
        }</p>
<p>        private void GenerateThankYouCards()<br />
        {<br />
            GenerateOutput(&quot;\\Templates\\ThankYouCards.in.docx&quot;, ThankYouCardManager.GetThankYouCardData(), &quot;ThankYouCards.docx&quot;, false);<br />
        }</p>
<p>        private void GenerateOutput(String templateFileName, DataTable templateData, String outputFileName, bool useNextFields)<br />
        {<br />
            WordTemplate wt = new WordTemplate(); //Create Word Template<br />
            wt.EnableNEXTFields = useNextFields; // Need to enable this for the labels<br />
            wt.Open(Page.MapPath(templateFileName)); //Open Template File<br />
            wt.SetMailMerge(templateData); //Read in Data and Perform a Mail Merge<br />
            wt.Process(); //Process the file<br />
            wt.Save(Page.Response, outputFileName, false); //Save it back to the context stream so the user is prompted to save the file<br />
        }<br />
}<br />

holidaycards2013

STEP 3 – CUSTOMIZING THE SAMPLE APPLICATION:

CUSTOMIZE THE TEMPLATES:

While I have worked with OfficeWriter for some time, my background is in programming, not design. The great feature of OfficeWriter is that it is able to find where to put the data wherever they are in the document, so I encourage you to make the forms prettier than what I have provided. You can navigate to the Templates folder in the solution and modify any of:

  • the HolidayCards.in.docx
  • the Labels.in.docx
  • the ThankYouCards.in.docx

USING YOUR OWN DATA:

The code this year imports from a Comma Separated Values file, produced from Gmail. With minimal modification you can use your own CSV files. Some common applications that let you export to .CSV files are Outlook, Gmail (use the Outlook CSV file format from Gmail), and many other email and contact management clients. More instructions are built into the application for easy reference.

MORE IDEAS AND WAYS TO USE THIS CODE:

In my solution I used .CSV files to store my contacts, but if you are a company this code can easily be expanded to read your data from your company’s database and easily help you automate many parts of your company – think offer letters, contracts, invoices, newsletters or training/award certificates. The list goes on and on.

Stay tuned for a video coming soon of a behind-the-scenes look at how we put this all together!

Troubleshooting Tools to Give Thanks to this Thanksgiving

$
0
0

thanskgiving

[Once a week I snoop around the office, bothering my coworkers with questions on what they’re reading, listening to, consuming, or any other random inquiries I’d like to subject them to. Sometimes they even respond.]

Debug, de-stress. This week we’re giving thanks to these troubleshooting tools that keep us sane. We chose troubleshooting tools not for the alliteration value (though, that was a happy coincidence), but to find time-saving ways you can stay on top of your coding projects this holiday season. See below as we show our appreciation for developer tools we can’t live without. What other tools do you use to debug and de-stress? Tell us about them in the comments section below.

Chad, Sr. Sales Engineer

Fiddler2 helps make debugging web service calls easy.

Paula, Director of HR

Don’t even need to think about that one – System Restore Manager!

Ozgur, Development

I’d definitely list Fiddler and WireShark as some of the top troubleshooting tools that I am thankful for.

Aviva, VP of Technical Services

I mostly use the debugger in Visual Studio or custom code I write myself. Although it’s not a development tool, Procmon can be helpful, for monitoring activities on the filesystem and registry.

Stephanie, Technical Services

Total Commander is great. The program does a ton of stuff, but I really like its “Compare by Content” feature. It lets you compare two files. It’s like an XML diff, but it’s capable of comparing more than just XML, which is super helpful in TS when we need to troubleshoot RDLs and Excel workbooks. It does a better job of comparing files than XML diff or bitbucket source control!

Gabe, Technical Services

Fiddler – it’s a web debugging proxy that logs all your HTTP traffic.  It’s great because you can view and edit HTTP requests sent from your computer, and then resend them.  It makes it much easier to figure out why you are getting bad responses.

Dan, CEO of SoftArtisans

My brain.

How to Use Worksheet Protection Properties In ExcelWriter

$
0
0

How to Use Worksheet Protection Properties In ExcelWriter

In ExcelWriter 8.6.1, the ability to set specific worksheet protection properties was added with the new Sheet Protection Object. Worksheet Protection Properties allow the user to add permissions to do certain actions on protected worksheets.

The Excel Protection Properties

Excel Worksheet Protection Property ExcelWriter SheetProtection Object Property
Select Locked cells SheetProtection.AllowSelectLockedCells
Select Unlocked Cells SheetProtection.AllowSelectUnlockedCells
Format Cells SheetProtection.AllowFormatCells
Format columns SheetProtection.AllowFormatColumns
Format Rows SheetProtection.AllowFormatRows
Insert Columns SheetProtection.AllowInsertColumns
Insert Rows SheetProtection.AllowInsertRows
Insert Hyperlinks SheetProtection.AllowInsertHyperlinks
Delete Columns SheetProtection.AllowDeleteColumns
Delete Rows SheetProtection.AllowDeleteRows
Sort SheetProtection.AllowSort
Use Autofilter SheetProtection.AllowUseAutoFilter
Use PivotTable reports SheetProtection.AllowUsePivotTableReports
Edit Objects Not Supported by ExcelWriter
Edit Scenarios Not Supported by ExcelWriter

Protection Properties Limitations

Microsoft Excel has a limitation on four of the protection properties: AllowSort, AllowDeleteColumns, AllowDeleteRows, and AllowInsertHyperlinks. These properties require that affected cells be editable when the worksheet is locked. This is because these properties entirely remove cells or alter the content of cells that are protected. Therefore, in order to use the properties you must unlock cells, put cells in an editable range, or use a macro.

Using the Protection Properties in Excel Writer

Steps to Use Protection Properties in ExcelWriter: 

  1. Create a new sheet protection object
  2. Set the worksheet protection properties as desired. By default, Select Locked cells and Select Unlocked Cells are set to true
  3. Call Protect() on the worksheet
            //Create a sheet protection object for the first sheet of the workbook
            SheetProtection protection = excelWb[0].SheetProtection;

            //Set the properties how you want them
            protection.AllowFormatCells= true;

            //Call worksheet.Protect() to protect the worksheet, set the password,   and apply your properties settings
            excelWb[0].Protect("password");

Enabling Sorting (or other limited protection properties) with ExcelWriter

If you want to use AllowSort, AllowDeleteColumns, AllowDeleteRows, and AllowInsertHyperlinks, you can by making a range with those affected cells editable. For more information about implementing this workaround in Excel, see this article. Here are the steps to implement it with ExcelWriter:

In your template:

  1. Select the cells you would like to use one of the limited protection properties on
  2. Go to Review-> Allow Users to Edit Ranges
  3. Click New and then OK
  4. To exit the dialogue, click Apply and OK

In your code:

  1. Set the worksheet protection property AllowSelectLockedCell to false
  2. Set one of the limited protection properties to true: AllowSort, AllowDeleteColumns, AllowDeleteRows, or AllowInsertHyperlinks
  3. Activate worksheet protection with the worksheet.protect() method
            //Create a new workbook
            ExcelApplication excelApp = new ExcelApplication();
            Workbook excelWb = excelApp.Open(Page.MapPath("SomeTemplate.xlsx"));

            //Create a sheet protection object for the first sheet of the workbook
            SheetProtection protection = excelWb[0].SheetProtection;

            //Set AllowSelectLockedCells to false.             
            protection.AllowSelectLockedCells = false;

            //Set the four limited properties to true
            protection.AllowInsertHyperlinks = true;
            protection.AllowDeleteColumns = true;
            protection.AllowDeleteRows = true;
            protection.AllowSort = true;

            //Call worksheet.Protect() to protect the worksheet, set the password, and apply your properties settings
            excelWb[0].Protect("password");

How I Learned to Love My Data: Gobbles and Gobbles of Data

$
0
0

Love your dataLet me preface this by saying I am a communications major, a lover of language and all things related to the humanities, following the auspices of the left brain. Science, statistics, numbers, data – that was for my logically-minded friends. Attending a research university, I was constantly surrounded by studies, which as you guessed it, are based off of piles and piles of data. It’s not that I didn’t understand the importance of data, it’s that I just never loved it. As a communications major I tended to shy away from numbers. (Okay, more like run flailing in the opposite direction as though my life depended on it.) Turns out numbers are a very real part of marketing, if not the crux of every marketing campaign. It allows you to measure what is working for your goals and what needs adjustment.

Generally speaking, I love the insights it gives, the conclusions it reaches. I just don’t enjoy the process of data collection in order to reach those conclusions. But who does? With data tied to many different sources, and housed in varying formats, it’s not easy to make it come together in one simple report. I’d like my data handed to me, preferably on a silver platter. Yes, well, that’s not how it works. And that’s not how it should work. In order to really understand the insights and not be misled by false assumptions, you should be able to understand where this data is coming from, how things are being measured, and what the goals are behind it.

Working at a software company, whose product deals with a ton of data and is designed for companies processing it to perform their reporting, I’ve had to become more comfortable with it. In any job this is a valuable skill to possess. Being able to deliver reports and present your work and results to the company/client/manager is a very necessary part of any business, and one that CEOs and execs place a lot of stake in. Not only that, it puts a tangible number to your work you can point to, to assess improvements and successes.

While there is this necessary business side to data collection, that doesn’t have quite the same motivation to learning to fully appreciate it. As I dove deeper into the weeds – spreadsheets, SSRS, Big Data, dark data, and servers – I discovered the ways in which people were using these numbers, the artful approach to using and displaying the information that is being collected. My coworkers showed me spreadsheets can be the springboard for masterpieces (see: Baking Cookies in Excel and Making Art with Excel). Speaker and data visualization blogger, Cole Nausbaumer, showed me you can infuse creativity into numbers. In her Storytelling with Data blog, she shows the meshing of the creativity behind presenting your data in a way people can relate to and process it: the age old art of storytelling. Now that is something to which I can relate. (If you haven’t yet, you should read her blog, and pick up tricks on data visualization.)

Along the same lines of displaying your data, a friend directed me to The Guardian’s Data Blog. The Guardian publishes a series of posts on interactive data visualizations they put together based off of different data sets. It’s a great learning tool and gives a hands on approach to the type of insights you can grab from data sets.

Along my deep dive into the weeds, I learned of organizations such as Code for America, which facilitate civic hacks, where people use open government data to design projects aimed at improving aspects of their town.

There’s this very beautiful, visual aspect to data that the left-brained side of me wants to embrace. Projects, people, and organizations like those mentioned above played a pivotal role in showing me that. Science is its own form of beauty. It’s just finding out how to overcome that challenge of communicating it (See TED Talk: Melissa Marshall’s Talk Nerdy to Me). It is possible for art and science to come together to form something creative and informative. When you start to look at data as a way to tell a story or create a visualization from it, that is something I can relate to, that is something that draws a left-brained person like me into the realm of tech and big data.

How do you find value in your data? What ways have you found to make the numbers more manageable?

Resources:

The Guardian’s Data Blog

TED Talk: Melissa Marshall’s Talk Nerdy to Me

Storytelling with Data by Cole Nausbaumer 

Code for America


Creating Holiday Cards and Other Unexpected OfficeWriter Projects

$
0
0

Last week, our VP of Development Sam and Senior Sales Engineer Chad were challenged to look at different ways to use OfficeWriter. The result? They put together a project designed to keep you in touch with your friends and family this holiday season. They looked at using OfficeWriter’s mail merge feature in a new way. Plus, they took that one step further, looking at how the technologies from this project can be applied to business applications within your company. Before heading home for the holidays, take a little inspiration from this behind-the-scenes video of unexpected ways to use OfficeWriter in building your reports and company documents.

Read the original post, get the code, and take a behind-the-scenes tour of the technologies it runs on.

Embedly Powered

via Vimeo

Want to get straight to the point? Skip to the end of the video to discover how this project could be applied to your business.

Meet the Team: Annie

$
0
0

[Hello and welcome to our Meet the Team series, in which we aim to give you deeper insight into the minds and personalities of those who make up this eclectic, close-knit group. We are developers, marketers, and technical support engineers, and at work we craft everything from Microsoft reporting APIs to mobile email applications. And outside of work? Let’s just say racing against the machine during hackathons, building architecturally sound beer towers during retros, and paddling down the Charles during the warmer months are simply the beginning.]

Annie

Meet Annie - Bridging the gap between software and the non-technical, our Associate Sales Director Annie answers all things OfficeWriter. This proud mom and runner has an affection for the outdoors and a warmth that brightens the office even from across the coast.

1. What do you do?

Sales / Business Development

2. What are you listening to right now?

iPhone on shuffle: Keith Urban, U2, Maroon 5, Eric Clapton, Jason Mraz, Ne-Yo (hee, hee), etc.

3. When you were 5 what did you want to be and why?

An Astronaut

4. If you were a beer what would you be and why?

Stella or Corona – both remind me of relaxing, fun times

5. Fill in the blank. Contrary to popular belief I _____.

Live in Nevada not Colorado (Although, I used to live in CO.).

6. Describe your perfect Saturday in 10 words or less.

Run, Starbucks, hike with kids, bake cookies, date-night with Jeremy

7. When did you last laugh?

I laugh everyday (…and many times throughout the day) :)

8. Describe your personal style in one word.

Eclectic-sporty

9. What is your worst nightmare?

My children being in danger

10. If you were a superhero, what would be your superhero name/power? 

Uber MommaExecWifeVolunteer aka Wonder Woman

11. What 3 things would you bring to a deserted island?

Serene (a superyacht) – fully stocked and an unlimited supply of gas, of course

12. Who would play you in a movie of your life?

Sandra Bullock

13. What is the last thing you bought?

Sorels….and groceries, of course.

14. What are your biggest pet peeves?

Wet socks, not picking up after yourself

15. Name something that makes you smile.

My children

16. If you could teach a college course what would it be?

Demystifying Technology – a class for non-technical people.  I love helping take the anxiety out of working with computers and software applications

10 Tips for Handling Inherited Code

$
0
0

[Kate, one of our developers at SoftArtisans, was pulled onto a project to do consulting work for UCLA. Kate discusses her work with REACTOR, a web-based system for tracking and managing the health cases for laboratory research animals. Read about the lessons she's learned after being gifted a whole new project of code.]Credit: HubSpot

Recently, I inherited the code for REACTOR. It’s a pretty huge chunk of a project, and anyone who knew the application wasn’t around when I took it over. Learning a brand new application is a daunting task – doubled if you have to learn it without any outside resources. As I tried to familiarize myself with the application, I picked up a few tricks to handling inherited code. These are a few of the things I learned along the way that will hopefully save you hours on your next undertaking.

1. Resist temptation

It can be really hard to ignore glaring implementation flaws when you look at code for the first time. Unfortunately, there are often reasons that the junky code exists in the first place. It might not be the best solution, but if it works, just leave it. Until you fully understand what each piece of code does, you might break something unintentionally by trying to fix it. Now you’ve lost time and still don’t understand the code any better. Unless it’s necessary for your current scope of work, make a tech debt note about why it’s bad code, and back away slowly.

2. Check the docs

I learn by immediately messing around in the code and doing as much damage as possible before rolling back. This isn’t really great, but hands-on learning is so natural for most technical things that we forget about reading. You. Yes, you. You are a developer so reading seems really unnecessary. Unfortunately, we still haven’t found a way to automate it, so you’ll have to do the reading yourself. Look at any documentation that might be around. It’ll suck. It won’t make a bit of sense. Then in 6 months, you’ll look at a weird method and remember that the docs said why it was like that. And you’ll think to yourself, “Ah, well, Old Fellow, looks like that reading did more than a mite bit of good!” and you’ll laugh and light up a cigar with your adoring fans swooning and giggling. Unless, you know, you’re a normal person and not a caricature of an old famous British man. Which brings me to 3…

3. Be a caricature of an old famous British man. No. Kidding. Don’t do this. (But if you do this, let’s be friends.)

3. Check the change log

It’s useful to see what might have been done recently, what kinds of issues have been encountered, and where those fixes lie. If there’s bug tracking, change logs, general progress docs, find them all. You don’t have to memorize every issue, but go over some known problems and keep yourself from making the same mistakes.

4. Be a user

It’s a lot easier to understand the code if you take some time to use the actual application. Use it like a user would, ask users (or consult the people who already did), find out why this is the way it is. There might be a good reason that all the buttons are yellow and labeled “Do not click.” It might help the users’ workflow. Make sure you know, because ultimately if the people who need this hate what you’ve done, someone else will be inheriting this code from you.

5. Just ask

When you inherit code blind, it’s awful. I mean, of course, the last ten people to look at this have all left the company/country/planet, and you’re all alone and in the dark. However, it doesn’t hurt to ask around and find out if anyone else knows what’s up. Alternately, if you have someone who knows the code, don’t get stuck in “Am I seriously doing this wrong?” hell, and just ask the question. 9 times out of 10, the code is confusing because it’s confusing code.

6. Look before you implement

It’s great when you can finally work on the code you’ve inherited. But don’t jump right in unless you’re sure that what you’re working on is necessary. Don’t start coding until you’ve searched everywhere for the functionality you’re about to create. There may already be a GetData method, but it’s called “FindData,” “GiveMeData,” “_getData,” “oGetData” (this is very wrong), or “Eric.” You just never know. If something has already been implemented, you don’t want to write it all over again. Same goes for anywhere the code is touching. Does this happen at the database level? Is everything you need in a web service you haven’t explored? You don’t know until you know, so, you know, KNOW you know.

7. It’s not all in the code

It sounds simple, but keep in mind that before you start working on inherited code, you need to understand how it’s tested, where it lives, how to run/deploy/build it. The code is only part of it. It’s easy to start working on something and then realize you have no idea how in the world to test it. (I just did this for a few weeks. Unit tests and I are not on good terms right now.) If you can’t do anything with it, what’s the point? If this is mystery code and no one really knows, your first goal should be to find out the whole life cycle of developing on this nonsense.

8. Maintain consistency

You name all internal variables _objectName, but the developer before you used objectName. Maybe you like setting strings to “” and the developer before you used string.null. Whatever. Get it together. Make sure that if you make a formatting change it’s consistent across the project. If it’s too big a change to make, then you’ll have to adopt some new formatting standards for now. Put it in tech debt and move on. It’ll be okay one day.

9. Break it.

The best part! Mess around, comment things out, print stuff to console, step in until you get to system classes. Just break the thing. Implement something fake. Ruin all the tests. Do whatever weird hands-on thing you do to learn the code. It’ll be a lot faster with all this background handled. Oh, and roll back to a working version once everything is broken.

10. End the cycle

Honestly, I hate documenting code I’ve inherited. I had to learn this on my own, let the next person suffer. However, spite aside, it also means you are no longer the only resource for the project. Yes, it’s nice to never have to write things down (why did I even bother learning to code if I still have to read and write?), but it’s nicer to not have to field tons of questions (oh right, because if there are docs, no one will try to talk to me while I’m working). Keep track of it for the next guy, because that next guy might be you. Okay, not really. You’re not going to inherit code from yourself, but it makes it a lot nicer for the next person who has to work on it. What would you liked to have found when you started working on this?

I’ve reached the point where I’m passing along the REACTOR code to someone else. I’m not sure I’ve actually ended the cycle, but hopefully I’ve helped a little. (Steph, I hope you’re reading this.)

Introduction to VSTO Document-Level Customizations

$
0
0

For many years, the only way to add interactivity to an Office workbook or document was to use VBA Macros. However, in more recent years, Microsoft has offered a newer .NET developer tool called Visual Studio Tools for Office (VSTO). To customize a particular document or workbook using VSTO, you can use a project type called “document-level customization.” While the end-user functionality of these solutions overlap, they have very different development processes and practical implementations. In this article, we will discuss how to use VSTO document-level customizations and how they differ from their predecessor.

VSTO in a Nutshell

VSTO offers a developer two different project types: document-level customizations and application-level add-ins. Document-level customizations are projects based around a single workbook or document. Application-level add-ins, on the other hand, are add-ins affecting the UIs of Microsoft Word, Microsoft Excel, Microsoft PowerPoint, Microsoft Outlook, or Microsoft InfoPath applications themselves. In this article, we will talk about document-level customizations.

By leveraging the .NET framework, VSTO can turn a document into a full-fledged application that must be installed onto an end user’s computer. While using .NET offers a programmer nearly limitless possibilities and integration with many other services and libraries, it also means that it requires Visual Studio and strong coding skills to develop the customizations. Updates to a customization will be issued from a  server or disk where the customization is deployed. However, the updates are not without limitations. VSTO updates the code attached to a document, but it does not update the visual formatting done to workbook via Visual Studio’s Designer or Excel. All visual formatting must be done in code to be included in automatic updates. A second limitation is that a user will not be able to have more than one version of the customization on their machine at one time.

VSTO Advantages VSTO Disadvantages
  • Offers full .NET framework integration
  •  A lot of developer and client requirements
  • More robust projects
  •  Because it requires VS Premium or Ultimate, it may be more expensive to develop
  • Offers new project type: Task Pane
  •  Cannot have multiple versions of a project installed on a client machine
  •  All distributed applications will be updated to be the most recent version of the application
  • Must have strong coding skills to use
  •  Uses Visual Studio to develop code
  •  VSTO will update the code attached  to a document, but it will not update designer or template formatting
  •  Can use VBA macros inside of documents containing VSTO document-level customizations
  •  VSTO code is not located within the document, but is installed separately

Compared with VBA

VBA has been around since 1993 and is the simplest way to add interactivity to an Office document. The basic advantages and disadvantages of using VBA are outlined below:

VBA Advantages VBA Disadvantages
  • Is accessible to people with no programming knowledge by using macro recording
  • Many security issues
  • Places code directly into document
  • Less extensive object model
  • Allows you to keep a specific version of a document with its code
  • Cannot easily be updated across all distributed documents
  • Only requirement for developers and clients is to have a version of Microsoft Office
  • Users can view and edit code if they know where to look
  • Easy to use

Creating a Document-Level Customization with VSTO

Before you can use VSTO, please make sure you have all of the developer and client requirements.

  1. Open Visual Studio.
  2. Click New Project.
  3. Expand either the C# or VB menu.
  4. Expand the Office menu.
  5. Click Excel Workbook/ Word Document.
  6. VS will now ask you if you want to create a new workbook from scratch or use an existing Excel document as a template for your new workbook. Select what is appropriate.
  7. The project will be created:
    1. The design view of your project will now be shown.
    2. If you are creating an Excel workbook, the default host application, workbook, and worksheet objects will have been auto-generated.
    3. If you are creating a Word document, the default host document object will have been auto-generated.

Developing Your Customization

The most fundamental libraries you will use in your VSTO customization are the native Excel and Word object models and the VSTO Host Items.

Native Microsoft Excel and Word Object Models

  • Excel has native classes that make up the object model and they are part of the Microsoft.Office.Interop.Excel and Microsoft.Office.Interop.Word namespaces.
  • Excel Model: Application is the parent class and Workbook, Worksheet, Range are its children.
  • Word Model: Application is the parent class, and its children are Document, Range, Selection, and Bookmark.

VSTO Host Items

  • These are extensions of the native Microsoft Word and Excel objects.
  • The host items are part of the VSTO Microsoft.Office.Tools namespace and exhibit almost identical structure, methods, and properties as the native classes.
  • The extensions include several additions, such as databinding.
  • When you create document-level implementations with VSTO, you will mostly be using host items.

Debugging Your Customization

  • After you press F5 to build and debug your project, you must remember to go to the Build menu in Visual Studio and click Clean Solution. This is because ClickOnce, which deploys the solution so you can build it, will store the project in its cache. The cache must be cleared or the project will run every time you open Excel or Word.

Deploying Your Customization to a Server with ClickOnce

The simplest way to deploy your project is by using ClickOnce, which allows users to automatically check for updates to their add-on.

Option 1: Microsoft has a great video that explains the deployment process using the simple Publish method accessed by right-clicking your solution.

Option 2: For the most customization options, we will publish from the Project menu:

  1. Go to the Project Menu and click “<project name> Properties”
  2. On the side menu click “Publish.
  3. Select a publishing folder location: a disk path, file share, or website to publish the project to.
  4. Select the Installation Folder URL: the URL, UNC path, or CD-ROM/DVD-ROM where the .VSTO (VSTO Deployment Manifest) will live on the server. This is the filepath that will store the .exe that will distribute the download to clients. Its important to set this URL because this is where OneClick will check for updates.
  5. Under Install Settings, you can set installation prerequisites, update options, and other advanced options.
    1. Click the Updates button.
    2. In the dialog, select how often you want updates to be checked for.
  6. Under Publish Version, make sure the Automatically increment revision with each releases is checked.
    1. Click Publish Now.

The published project will now be located in the folder you selected to publish to. In order to complete deployment for an application deploying to the web:

  1. Open IIS Manager.
  2. Add your project as an application to a site on the IIS server. Be sure the location of your .exe matches what you specified as the installation path when you published the project.
  3. You can now distribute your document just as you would any other Excel or Word file.

What Happens When End Users Open a VSTO Customization

When users open the VSTO document customization you created for the first time, the document will connect to the server/disk location where the .exe is installed and begin installing the VSTO code. Each time they open the customization after that, the document will determine whether it should check for a new .exe version based on the update frequency you checked off when you published. For more information on the issues that can happen with updates, refer to this article.

Why Do Some Blank Cells Return Different Values in OOXML?

$
0
0

Problem

Some blank cells in OOXML file formats return an empty string, while other blank cells return null.  The same file in BIFF format returns only null values.

This problem occurs because OOXML (.xlsx /.xlsm) preserves any empty strings in cells when the file is saved.  When saving a file in BIFF (.xls) any cells containing an empty string will be set to a null value.

This can be a concern for users switching to the OOXML file formats. Code that checks worksheets for null values may need to be amended to account for the change in behavior.

Example 


The following code illustrates how this discrepancy might affect users:

           ExcelApplication xlapp = new ExcelApplication();
		   Workbook wb = xlapp.Open("SampleFile.xlsx")  
		   Worksheet ws = wb[0];

		   //Trim a range of cells. 
		   //Because A1 is empty, its value will be 'empty string' after trimming.
		   for(int i = 0; i<= 20; i++)
           {
		   	  for(int j = 0; j<= 20; i++)
              {
                  string value = (string)ws.Cells[i, j].Value;
				  ws.Cells[i, j].Value = value.Trim();
              }
           }

 		   //Save and reopen the file in the OOXML format
           xlapp.Save(wb, Directory + "SampleFile.xlsx");
           wb = xlapp.Open(Directory + "SampleFile.xlsx");
           ws = wb.[0];
           if (ws.Cells[0, 0].Value == null)
            {
               // This code would be reached in .xls
			   // but not in .xlsx  
            }

Users who currently check for cells containing null values may find that their code produces unexpected results when switching to OOXML files.


Solution

In order to ensure that code will return correct results when dealing with blank cells, it is important to use logic that handles all possible values.  There are 2 ways that we suggest implementing this logic.

Solution 1 – Use IsNullOrEmpty when checking for blank cells

Use logic that checks whether a cell is either null or an empty string.

Example:

            if(string.IsNullOrEmpty((string)ws.Cells[0, 0].Value))
            {
               //With this new logic, it could be either file format
                ws.Cells[1, 1].Value = "This is a .xls or an .xlsx file";   
            }

Solution 2 – Keep empty string values from being assigned to cells

Check if a cell is null before performing any operations that would assign an empty string value to a null cell.

Example:

           //Check that the cell is not empty before trimming
           if( ws.Cells[0,0].Value != null)
           {
                  string value = (string)ws.Cells[0, 0].Value;
				  ws.Cells[0, 0].Value = value.Trim();
           }
Related Information:

If your worksheet contains formulas, best practice would be to check the cell for formulas as well. More information on how to check for empty cells can be found here.


Viewing all 140 articles
Browse latest View live