How to center GUILayout.TextArea in a GUI.Window

I want to make an alert window like you get in web pages with javascript, and i want the content text to be centered in the window. I know i can use javascript in webpage to use html code but i would like tomake it with GUI

I tried GUILayoutUtility.GetRect to get the height of the content but seems it doesnt work. Somehow when i use it it adds space in the window vertically instead of just giving a Rect to be used in the BeginArea

GUILayoutOption[] opciones = new GUILayoutOption[2];
		opciones[0] = GUILayout.MaxHeight(windowRectAlerta.height*0.9f);
		opciones[1] = GUILayout.Width(windowRectAlerta.width*0.8f);
	 	areacontenido = GUILayoutUtility.GetRect(new GUIContent(mensajeAlerta),estiloAlerta,opciones);
		if(areacontenido.height>1) YRectAlerta=areacontenido.height*0.5f;
		Rect centrararea = new Rect(0,windowRectAlerta.height*0.5f-YRectAlerta,areacontenido.width,areacontenido.height);
		GUILayout.BeginArea(centrararea);
			GUILayout.TextArea(mensajeAlerta);
		GUILayout.EndArea();

You would most probably get better results if using GUI than GUILayout methods.

For centering GUI, check out this post.

Finally i used GUI.Label instead a window