How to arrange the obtained results according to the descending power of x?

Clear[“`*”]

eqns = {x^2/a^2 + y^2/b^2 == 1, y == k (x - x0) + y0};  

polyex = Apply[Subtract, eqns, {1}];

polys = Numerator[Together[polyex]];

xpoly = Collect[Resultant[polys[[1]], polys[[2]], y], x]

The above results are:

-a^2 b^2 + (b^2 + a^2 k^2) x^2 + a^2 k^2 x0^2 - 2 a^2 k x0 y0 + 
 a^2 y0^2 + x (-2 a^2 k^2 x0 + 2 a^2 k y0)

How to get the results I want:

(b^2 + a^2 k^2) x^2+x (-2 a^2 k^2 x0 + 2 a^2 k y0)+a^2 k^2 x0^2 - 2 a^2 k x0 y0 + a^2 y0^2-a^2 b^2

Here is a way:

poly = -a^2 b^2 + (b^2 + a^2 k^2) x^2 + a^2 k^2 x0^2 - 2 a^2 k x0 y0 +
    a^2 y0^2 + x (-2 a^2 k^2 x0 + 2 a^2 k y0);
Inactive[Plus] @@ Reverse[CoefficientList[poly, x]*{1, x, x^2}]

Clear[“`*”]

eqns = {x^2/a^2 + y^2/b^2 == 1, y == k (x - x0) + y0};  

polyex = Apply[Subtract, eqns, {1}];

polys = Numerator[Together[polyex]];

xpoly = Collect[Resultant[polys[[1]], polys[[2]], y], x]

Inactive[Plus] @@ Reverse[CoefficientList[xpoly, x]*{1, x, x^2}]

the result is:

-a^2 b^2 + (b^2 + a^2 k^2) x^2 + a^2 k^2 x0^2 - 2 a^2 k x0 y0 + 
 a^2 y0^2 + x (-2 a^2 k^2 x0 + 2 a^2 k y0)

Thank you very much. This result is what I want.

If we want to get further results like this, what should we do?

(b^2 + a^2 k^2) x^2 + (y0 - kx0) 2 a^2 k x + (-a^2 b^2 + 
   a^2 k^2 x0^2 - 2 a^2 k x0 y0 + a^2 y0^2)

That is to extract the common factor of x ^ 2, x and constant terms

There is an obvious problem with this method, that is, when arranging by the descending power of x, the± two symbols are connected together.

the problem shown in the picture below:

Try TraditionalForm. It may or may not do what you want. The display of polynomials or other formulas in the exact way one wishes can be frustrating.

Inactive[Plus] @@ MonomialList[poly, {x}]

or

Plus @@ HoldForm /@ MonomialList[poly, {x}]

If you want absolute and precise control over the sequence and sign of terms, then you’re probably going to have to write your own complicated formatting function based on CoefficientList or CoefficientRules or some related destructuring function.

Clear[“`*”]

eqns = {x^2/a^2 + y^2/b^2 == 1, y == k (x - x0) + y0};  

polyex = Apply[Subtract, eqns, {1}];

polys = Numerator[Together[Apply[Subtract, eqns, {1}]]];

xpoly = Collect[Resultant[polys[[1]], polys[[2]], y], x];

xp = Inactive[Plus] @@ MonomialList[xpoly, {x}];

eqn = {xp == 0}

discx = Factor[Discriminant[xpoly, x]]   (*discriminant*)

{{x1, y1}, {x2, y2}} = SolveValues[eqns, {x, y}] // FullSimplify;

second = {x1 + x2, x1 x2, y1 + y2, y1 y2, 
   y1 y2/(x1 x2), (x1 + x2)/2, (y1 + y2)/2} // FullSimplify

thrid = {x1 x2 + y1 y2, x1 y2 + x2 y1} // FullSimplify

slope = -CoefficientList[polyex[[2]], x][[2]];    (*k*)

intercept = -CoefficientList[CoefficientList[polyex[[2]], y][[1]], 
     x][[1]] ;  (*m*)

Chordlength = 
 FullSimplify[
  Sqrt[1 + slope^2] Sqrt[(x1 + x2)^2 - 4 x1 x2]]    (*AbsAB*)

area = 1/2 Chordlength Sqrt[intercept^2]/Sqrt[slope^2 + 1] // 
  FullSimplify