The justices unanimously upheld an appeals court’s ruling that went against the world’s largest software company in its legal battle with Toronto-based i4i Limited Partnership. The smaller company had argued that Microsoft Word had infringed its method for editing documents. Microsoft contended that i4i’s patent was invalid.