A computing device for document editing, a document having multiple objects to be aligned in one or more multi-layer grid layouts comprising first and second grid layouts, wherein the objects are rectangular objects in the document each object having four edges, the device comprising: a processing unit; a memory coupled to the processing unit and storing instructions for execution by the processing unit, the instructions, when executed by the processing unit, causing the device to: perform, on the edges of a plurality of the objects to be aligned, a first alignment to align the edges of the plurality of objects to reduce irregularities in edge ordering; characterized in that the instructions cause the device to obtain, from a result of the first alignment, a plurality of characteristic values of the plurality of objects, the characteristic values comprising a characteristic width of a column and a characteristic height of a row; group, based on the plurality of characteristic values and a predetermined policy, the edges of the plurality of objects, into a plurality of groups, to minimize a cost by using a cost function representing the cost of aligning the edges of the plurality of objects in each of the plurality of groups; perform, based on the first alignment, a second alignment on the edges of the plurality of objects in each of the plurality of groups, to generate the first grid layout of the plurality of objects; perform, based on the first grid layout of the plurality of objects, a third alignment to generate a second grid layout of the plurality of objects to determine an aligned position for each group and to decide spacing for each of the horizontal and vertical directions; in response to receiving a command from a user, apply the second grid layout to the plurality of objects. a processing unit; a memory coupled to the processing unit and storing instructions for execution by the processing unit, the instructions, when executed by the processing unit, causing the device to: perform, on the edges of a plurality of the objects to be aligned, a first alignment to align the edges of the plurality of objects to reduce irregularities in edge ordering; characterized in that the instructions cause the device to obtain, from a result of the first alignment, a plurality of characteristic values of the plurality of objects, the characteristic values comprising a characteristic width of a column and a characteristic height of a row; group, based on the plurality of characteristic values and a predetermined policy, the edges of the plurality of objects, into a plurality of groups, to minimize a cost by using a cost function representing the cost of aligning the edges of the plurality of objects in each of the plurality of groups; perform, based on the first alignment, a second alignment on the edges of the plurality of objects in each of the plurality of groups, to generate the first grid layout of the plurality of objects; perform, based on the first grid layout of the plurality of objects, a third alignment to generate a second grid layout of the plurality of objects to determine an aligned position for each group and to decide spacing for each of the horizontal and vertical directions; in response to receiving a command from a user, apply the second grid layout to the plurality of objects. perform, on the edges of a plurality of the objects to be aligned, a first alignment to align the edges of the plurality of objects to reduce irregularities in edge ordering; characterized in that the instructions cause the device to obtain, from a result of the first alignment, a plurality of characteristic values of the plurality of objects, the characteristic values comprising a characteristic width of a column and a characteristic height of a row; group, based on the plurality of characteristic values and a predetermined policy, the edges of the plurality of objects, into a plurality of groups, to minimize a cost by using a cost function representing the cost of aligning the edges of the plurality of objects in each of the plurality of groups; perform, based on the first alignment, a second alignment on the edges of the plurality of objects in each of the plurality of groups, to generate the first grid layout of the plurality of objects; perform, based on the first grid layout of the plurality of objects, a third alignment to generate a second grid layout of the plurality of objects to determine an aligned position for each group and to decide spacing for each of the horizontal and vertical directions; in response to receiving a command from a user, apply the second grid layout to the plurality of objects.